Code Monkey home page Code Monkey logo

pylama's Introduction

logo Pylama

Tests Status Documentation Status PYPI Version Python Versions

Code audit tool for Python. Pylama wraps these tools:

  • pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna;
  • pydocstyle (formerly pep257 by Vladimir Keleshev) © 2014, Amir Rachum;
  • PyFlakes © 2005-2013, Kevin Watters;
  • Mccabe © Ned Batchelder;
  • Pylint © 2013, Logilab;
  • Radon © Michele Lacchia
  • eradicate © Steven Myint;
  • Mypy © Jukka Lehtosalo and contributors;
  • Vulture © Jendrik Seipp and contributors;

Docs are available at https://klen.github.io/pylama/. Pull requests with documentation enhancements and/or fixes are awesome and most welcome.

  • Python (3.7, 3.8, 3.9, 3.10)
  • If your tests are failing on Win platform you are missing: curses - http://www.lfd.uci.edu/~gohlke/pythonlibs/ (The curses library supplies a terminal-independent screen-painting and keyboard-handling facility for text-based terminals)

For python versions < 3.7 install pylama 7.7.1

Pylama can be installed using pip:

$ pip install pylama

TOML configuration can be enabled optionally:

$ pip install pylama[toml]

You may optionally install the requirements with the library:

$ pip install pylama[mypy]
$ pip install pylama[pylint]
$ pip install pylama[eradicate]
$ pip install pylama[radon]
$ pip install pylama[vulture]

Or install them all:

$ pip install pylama[all]

Pylama is easy to use and really fun for checking code quality. Just run pylama and get common output from all pylama plugins (pycodestyle, PyFlakes, etc.)

Recursively check the current directory.

$ pylama

Recursively check a path.

$ pylama <path_to_directory_or_file>

Ignore errors

$ pylama -i W,E501

Note

You can choose a group of errors like D, E1, etc, or special errors like C0312

Choose code checkers

$ pylama -l "pycodestyle,mccabe"
$ pylama --help

usage: pylama [-h] [--version] [--verbose] [--options FILE] [--linters LINTERS] [--from-stdin] [--concurrent] [--format {pydocstyle,pycodestyle,pylint,parsable,json}] [--abspath]
              [--max-line-length MAX_LINE_LENGTH] [--select SELECT] [--ignore IGNORE] [--skip SKIP] [--sort SORT] [--report REPORT] [--hook] [--max-complexity MAX_COMPLEXITY]
              [--pydocstyle-convention {pep257,numpy,google}] [--pylint-confidence {HIGH,INFERENCE,INFERENCE_FAILURE,UNDEFINED}]
              [paths ...]

Code audit tool for python.

positional arguments:
  paths                 Paths to files or directories for code check.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --verbose, -v         Verbose mode.
  --options FILE, -o FILE
                        Specify configuration file. Looks for pylama.ini, setup.cfg, tox.ini, or pytest.ini in the current directory (default: None)
  --linters LINTERS, -l LINTERS
                        Select linters. (comma-separated). Choices are eradicate,mccabe,mypy,pycodestyle,pydocstyle,pyflakes,pylint,isort.
  --from-stdin          Interpret the stdin as a python script, whose filename needs to be passed as the path argument.
  --concurrent, --async
                        Enable async mode. Useful for checking a lot of files.
  --format {pydocstyle,pycodestyle,pylint,parsable,json}, -f {pydocstyle,pycodestyle,pylint,parsable,json}
                        Choose output format.
  --abspath, -a         Use absolute paths in output.
  --max-line-length MAX_LINE_LENGTH, -m MAX_LINE_LENGTH
                        Maximum allowed line length
  --select SELECT, -s SELECT
                        Select errors and warnings. (comma-separated list)
  --ignore IGNORE, -i IGNORE
                        Ignore errors and warnings. (comma-separated)
  --skip SKIP           Skip files by masks (comma-separated, Ex. */messages.py)
  --sort SORT           Sort result by error types. Ex. E,W,D
  --report REPORT, -r REPORT
                        Send report to file [REPORT]
  --hook                Install Git (Mercurial) hook.
  --max-complexity MAX_COMPLEXITY
                        Max complexity threshold

Note

additional options may be available depending on installed linters

You can set options for Pylama inside a source file. Use a pylama modeline for this, anywhere in the file.

Format:

# pylama:{name1}={value1}:{name2}={value2}:...

For example, ignore warnings except W301:

# pylama:ignore=W:select=W301

Disable code checking for current file:

# pylama:skip=1

Those options have a higher priority.

Just add # noqa at the end of a line to ignore:

def urgent_fuction():
    unused_var = 'No errors here' # noqa

Pylama looks for a configuration file in the current directory.

You can use a “global” configuration, stored in .pylama.ini in your home directory. This will be used as a fallback configuration.

The program searches for the first matching configuration file in the directories of command line argument. Pylama looks for the configuration in this order:

./pylama.ini
./pyproject.toml
./setup.cfg
./tox.ini
./pytest.ini
~/.pylama.ini

The --option / -o argument can be used to specify a configuration file.

Pylama searches for sections whose names start with pylama.

The pylama section configures global options like linters and skip.

[pylama]
format = pylint
skip = */.tox/*,*/.env/*
linters = pylint,mccabe
ignore = F0401,C0111,E731

You can set options for a special code checkers with pylama configurations.

[pylama:pyflakes]
builtins = _

[pylama:pycodestyle]
max_line_length = 100

[pylama:pylint]
max_line_length = 100
disable = R

See code-checkers' documentation for more info. Note that dashes are replaced by underscores (e.g. Pylint's max-line-length becomes max_line_length).

You can set options for special file (group of files) with sections:

The options have a higher priority than in the pylama section.

[pylama:*/pylama/main.py]
ignore = C901,R0914,W0212
select = R

[pylama:*/tests.py]
ignore = C0110

[pylama:*/setup.py]
skip = 1

Pylama searches for sections whose names start with tool.pylama.

The tool.pylama section configures global options like linters and skip.

[tool.pylama]
format = "pylint"
skip = "*/.tox/*,*/.env/*"
linters = "pylint,mccabe"
ignore = "F0401,C0111,E731"

You can set options for a special code checkers with pylama configurations.

[tool.pylama.linter.pyflakes]
builtins = "_"

[tool.pylama.linter.pycodestyle]
max_line_length = 100

[tool.pylama.linter.pylint]
max_line_length = 100
disable = "R"

See code-checkers' documentation for more info. Note that dashes are replaced by underscores (e.g. Pylint's max-line-length becomes max_line_length).

You can set options for special file (group of files) with sections:

The options have a higher priority than in the tool.pylama section.

[[tool.pylama.files]]
path = "*/pylama/main.py"
ignore = "C901,R0914,W0212"
select = "R"

[[tool.pylama.files]]
path = "pylama:*/tests.py"
ignore = "C0110"

[[tool.pylama.files]]
path = "pylama:*/setup.py"
skip = 1

Pylama has Pytest support. The package automatically registers itself as a pytest plugin during installation. Pylama also supports the pytest_cache plugin.

Check files with pylama

pytest --pylama ...

The recommended way to set pylama options when using pytest — configuration files (see below).

You can write a custom extension for Pylama. The custom linter should be a python module. Its name should be like 'pylama_<name>'.

In 'setup.py', 'pylama.linter' entry point should be defined.

setup(
    # ...
    entry_points={
        'pylama.linter': ['lintername = pylama_lintername.main:Linter'],
    }
    # ...
)

'Linter' should be an instance of 'pylama.lint.Linter' class. It must implement two methods:

  1. allow takes a path argument and returns true if the linter can check this file for errors.
  2. run takes a path argument and meta keyword arguments and returns a list of errors.

Just a virtual 'WOW' checker.

setup.py:

setup(
    name='pylama_wow',
    install_requires=[ 'setuptools' ],
    entry_points={
        'pylama.linter': ['wow = pylama_wow.main:Linter'],
    }
    # ...
)

pylama_wow.py:

from pylama.lint import Linter as BaseLinter

class Linter(BaseLinter):

    def allow(self, path):
        return 'wow' in path

    def run(self, path, **meta):
        with open(path) as f:
            if 'wow' in f.read():
                return [{
                    lnum: 0,
                    col: 0,
                    text: '"wow" has been found.',
                    type: 'WOW'
                }]
from pylama.main import check_paths, parse_options

# Use and/or modify 0 or more of the options defined as keys in the variable my_redefined_options below.
# To use defaults for any option, remove that key completely.
my_redefined_options = {
    'linters': ['pep257', 'pydocstyle', 'pycodestyle', 'pyflakes' ...],
    'ignore': ['D203', 'D213', 'D406', 'D407', 'D413' ...],
    'select': ['R1705' ...],
    'sort': 'F,E,W,C,D,...',
    'skip': '*__init__.py,*/test/*.py,...',
    'async': True,
    'force': True
    ...
}
# relative path of the directory in which pylama should check
my_path = '...'

options = parse_options([my_path], **my_redefined_options)
errors = check_paths(my_path, options, rootdir='.')

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/pylama/issues

Development of pylama happens at GitHub: https://github.com/klen/pylama

See CONTRIBUTORS.

This is free software. You are permitted to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of it, under the terms of the MIT License. See LICENSE file for the complete license.

This software is provided WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE file for the complete disclaimer.

pylama's People

Contributors

blueyed avatar d3rp avatar diraol avatar famousgarkin avatar fizyk avatar fmv1992 avatar gmist avatar gotcha avatar grandvizierolaf avatar ilyalabun avatar jasonkit avatar jeffwidman avatar jotes avatar kevinoid avatar klen avatar lukaszpiotr avatar luzfcb avatar maxnordlund avatar michael-k avatar mrshark avatar orsinium avatar ravipudi avatar rzuckerm avatar s-nirali avatar thombashi avatar trojkat avatar tusharsnx avatar vayel avatar villainy avatar zadazorg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pylama's Issues

UnboundLocalError when trying to run pylama

Whenever I try to run pylama, I get this error

Traceback (most recent call last):
  File "/home/fizyk/.virtualenvs/ab/bin/pylama", line 9, in <module>
    load_entry_point('pylama==1.4.0', 'console_scripts', 'pylama')()
  File "/home/fizyk/.virtualenvs/ab/local/lib/python2.7/site-packages/pylama/main.py", line 43, in shell
    return check_files(paths, options, error=error)
  File "/home/fizyk/.virtualenvs/ab/local/lib/python2.7/site-packages/pylama/main.py", line 69, in check_files
    errors = async_check_files(work_paths, options, rootpath=rootpath)
  File "/home/fizyk/.virtualenvs/ab/local/lib/python2.7/site-packages/pylama/tasks.py", line 56, in async_check_files
    errors += check_path(path, options=options, rootpath=rootpath)
  File "/home/fizyk/.virtualenvs/ab/local/lib/python2.7/site-packages/pylama/tasks.py", line 102, in check_path
    config=config, **meta):
  File "/home/fizyk/.virtualenvs/ab/local/lib/python2.7/site-packages/pylama/core.py", line 83, in run
    errors = filter_skiplines(code, errors)
UnboundLocalError: local variable 'code' referenced before assignment

It's for pylama from version 1.4 onwards. 1.3.3 works perfectly

pylama crashes if pyflakes version < 0.9.0

(django_documentos)luzfcb@oficina:~/projetos/opensource/django_documentos$ pip install pylama
Collecting pylama
  Downloading pylama-7.0.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): mccabe in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages (from pylama)
Requirement already satisfied (use --upgrade to upgrade): pep8 in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages (from pylama)
Requirement already satisfied (use --upgrade to upgrade): pyflakes in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages (from pylama)
Collecting pep257 (from pylama)
  Downloading pep257-0.6.0.tar.gz
Building wheels for collected packages: pep257
  Running setup.py bdist_wheel for pep257
  Stored in directory: /home/luzfcb/.cache/pip/wheels/3b/cc/26/9dc89894b5852b3ee7335b2eb61e46cbeebac52504555ec4af
Successfully built pep257
Installing collected packages: pep257, pylama
Successfully installed pep257-0.6.0 pylama-7.0.0

(django_documentos)luzfcb@oficina:~/projetos/opensource/django_documentos$ pylama --version
Traceback (most recent call last):
  File "/home/luzfcb/virtualenvs/django_documentos/bin/pylama", line 7, in <module>
    from pylama.main import shell
  File "/home/luzfcb/virtualenvs/django_documentos/local/lib/python2.7/site-packages/pylama/main.py", line 8, in <module>
    from .config import parse_options, CURDIR, setup_logger
  File "/home/luzfcb/virtualenvs/django_documentos/local/lib/python2.7/site-packages/pylama/config.py", line 12, in <module>
    from .lint.extensions import LINTERS
  File "/home/luzfcb/virtualenvs/django_documentos/local/lib/python2.7/site-packages/pylama/lint/extensions.py", line 24, in <module>
    from pylama.lint.pylama_pyflakes import Linter
  File "/home/luzfcb/virtualenvs/django_documentos/local/lib/python2.7/site-packages/pylama/lint/pylama_pyflakes.py", line 21, in <module>
    checker.messages.ReturnOutsideFunction.message = "E0104 'return' outside function"
AttributeError: 'module' object has no attribute 'ReturnOutsideFunction'


(django_documentos)luzfcb@oficina:~/projetos/opensource/django_documentos$ pip install pylama -U
Requirement already up-to-date: pylama in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages
Requirement already up-to-date: mccabe in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages (from pylama)
Requirement already up-to-date: pep8 in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages (from pylama)
Collecting pyflakes (from pylama)
  Downloading pyflakes-0.9.2-py2.py3-none-any.whl
Requirement already up-to-date: pep257 in /home/luzfcb/virtualenvs/django_documentos/lib/python2.7/site-packages (from pylama)
Installing collected packages: pyflakes
  Found existing installation: pyflakes 0.8.1
    Uninstalling pyflakes-0.8.1:
      Successfully uninstalled pyflakes-0.8.1
Successfully installed pyflakes-0.9.2
(django_documentos)luzfcb@oficina:~/projetos/opensource/django_documentos$ pylama django_documentos tests

Validating JS files with githook

git_hook and hg_hook are filtering files with endswith('.py')

I guess that's a job for every Linter allow method to avoid excluding other file types (like .js) from validation:

class Linter(lint.Linter):
    """ Check code with gjlint """

    def allow(self, path):
        return path.endswith('.js')

AttributeError: 'PylamaItem' object has no attribute '_fixtureinfo'

pytest --fixtures-per-test --pylama
========================= test session starts ================================
platform linux2 -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
Django settings: xyx.settings.test (from command line option)
rootdir: /opt/xyz, inifile: pytest.ini
plugins: django-3.1.2, cov-2.4.0, catchlog-1.2.2, pylama-7.3.3
collected 231 items 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/main.py", line 98, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/python.py", line 1031, in _show_fixtures_per_test
INTERNALERROR>     write_item(item)
INTERNALERROR>   File "/usr/local/lib/python2.7/site-packages/_pytest/python.py", line 1012, in write_item
INTERNALERROR>     name2fixturedefs = item._fixtureinfo.name2fixturedefs
INTERNALERROR> AttributeError: 'PylamaItem' object has no attribute '_fixtureinfo'

=========================1 tests deselected ===================================
==================== 1 deselected in 0.15 seconds =============================
$ pytest --version
This is pytest version 3.0.5, imported from /usr/local/lib/python2.7/site-packages/pytest.pyc
setuptools registered plugins:
  pytest-django-3.1.2 at /usr/local/lib/python2.7/site-packages/pytest_django/plugin.py
  pytest-cov-2.4.0 at /usr/local/lib/python2.7/site-packages/pytest_cov/plugin.py
  pytest-catchlog-1.2.2 at /usr/local/lib/python2.7/site-packages/pytest_catchlog.py
  pylama-7.3.3 at /usr/local/lib/python2.7/site-packages/pylama/pytest.py
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/41275409-attributeerror-pylamaitem-object-has-no-attribute-_fixtureinfo?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

Wrong handling of ignored pydocstyle errors

Usually errors D203, D212, D213 and D404 are ignored in pydocstyle (see http://www.pydocstyle.org/en/latest/error_codes.html#default-checks). However, pylama seems to ignore this.

Using a MWE:

"""Doc."""

def func():
    """First line.

    Extra line.

    """

I see

$ pylama -lpydocstyle test.py
test.py:3:1: D213 Multi-line docstring summary should start at the second line [pydocstyle]
$ pylama -lpydocstyle --ignore=D213 test.py
$

Testing with pydocstyle directly gives

$ pydocstyle test.py
$
$ pydocstyle --select=D213 test.py
test.py:3 in public function `func`:
        D213: Multi-line docstring summary should start at the second line

Is this intended behavior?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40151744-wrong-handling-of-ignored-pydocstyle-errors?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

New configuration option `paths` not usable from .ini configuration file

We are currently (ab)using the path configuration option to define the top-level directory of the source code that should be scanned (best reason is to be more robust in the context of a continuous integration tool). Since the change in commit 7390602 the value returned by ArgumentParser is probably a list, but ConfigParser will still return a single string.

What's the right solution? Should we go back to skip all possible directories by hand (which is actually the only documented method) or attempt to fix this issue (which is roughly checking if the configuration argument is a string and split it)?

UnboundLocalError during ammend with rename

Hey,
When I try to git commit --amend with a file being renamed in changeset, I get the following error:

Traceback (most recent call last):
  File ".git/hooks/pre-commit", line 6, in <module>
    sys.exit(git_hook())
  File "/home/fizyk/.virtualenvs/kanary/local/lib/python2.7/site-packages/pylama/hook.py", line 40, in git_hook
    [f for f in map(str, files_modified) if f.endswith('.py')], options
  File "/home/fizyk/.virtualenvs/kanary/local/lib/python2.7/site-packages/pylama/main.py", line 70, in check_files
    errors = async_check_files(work_paths, options, rootpath=rootpath)
  File "/home/fizyk/.virtualenvs/kanary/local/lib/python2.7/site-packages/pylama/tasks.py", line 57, in async_check_files
    errors += check_path(path, options=options, rootpath=rootpath)
  File "/home/fizyk/.virtualenvs/kanary/local/lib/python2.7/site-packages/pylama/tasks.py", line 103, in check_path
    config=config):
  File "/home/fizyk/.virtualenvs/kanary/local/lib/python2.7/site-packages/pylama/core.py", line 91, in run
    errors = [er for er in errors if filter_errors(er, **params)]
UnboundLocalError: local variable 'params' referenced before assignment

what about mypy?

So the title says it all I guess. Have you guys thought about wrapping mypy as well? Can this be done?

Thanks!

Python 3.4-3.6 support?

What's the plan for proper and documented Python 3.4-3.6 support?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39174788-python-3-4-3-6-support?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

pylama --hook fails in pylama>=7

I've tried to install hook from nevest pylama version (7.0.0) and it unfortunately failed with this error.

Traceback (most recent call last):
  File "/home/fizyk/.virtualenvs/dvreports/bin/pylama", line 11, in <module>
    sys.exit(shell())
  File "/home/fizyk/.virtualenvs/dvreports/local/lib/python2.7/site-packages/pylama/main.py", line 74, in shell
    return install_hook(options.path)
AttributeError: 'Namespace' object has no attribute 'path'

haven't had time to look at this yet though

Broken install

This is somewhat hard to notice, since the directories libs and lint might be there from previous versions, but on a fresh install:

$ sudo pip install pylama
Downloading/unpacking pylama
Installing collected packages: pylama
Successfully installed pylama
Cleaning up...

$ pylama
Traceback (most recent call last):
  File "/usr/bin/pylama", line 7, in <module>
    from pylama.main import shell
  File "/usr/lib/python2.7/site-packages/pylama/main.py", line 8, in <module>
    from .config import parse_options, CURDIR, setup_logger
  File "/usr/lib/python2.7/site-packages/pylama/config.py", line 11, in <module>
    from .libs.inirama import Namespace
ImportError: No module named libs.inirama

pylama doesn't work with latest version of pylint

When I run pylama with the latest version of pylint (1.5.4 but also tried 1.5.0), I get a VersionConflict exception. It doesn't happen when pylint is on an older version, 1.4.4.

oamasood@Osmans-MacBook-Pro:~/src/my-project$ pylama my_app/
Traceback (most recent call last):
  File "/Users/oamasood/.pyenv/versions/2.7.9/bin/pylama", line 7, in <module>
    from pylama.main import shell
  File "/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pylama/main.py", line 8, in <module>
    from .config import parse_options, CURDIR, setup_logger
  File "/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pylama/config.py", line 12, in <module>
    from .lint.extensions import LINTERS
  File "/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pylama/lint/extensions.py", line 35, in <module>
    LINTERS[entry.name] = entry.load()()
  File "/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2354, in load
    self.require(*args, **kwargs)
  File "/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2371, in require
    items = working_set.resolve(reqs, env, installer)
  File "/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages/pkg_resources/__init__.py", line 844, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pylint 1.5.4 (/Users/oamasood/.pyenv/versions/2.7.9/lib/python2.7/site-packages), Requirement.parse('pylint==1.4.4'))

Setting --verbose doesn't give any additional input. Here's my tox.ini config:

[pylama]
skip = */.tox/*,*/.env/*,dashboard/*
linters = pylint,pep8,mccabe
format = pylint

[pylama:pep8]
max_line_length = 119

[pylama:pylint]
max_line_length = 119

[pylama:mccabe]
max-complexity = 10

When the pylint version is 1.4.4, it still gives me some errors on output, but it works:

Try to read configuration from: 
Namespace(abspath=False, async=False, file_params={}, force=False, format='pylint', hook=False, ignore=[], linters=[('pep8', <pylama.lint.pylama_pep8.Linter object at 0x107142d50>), ('pylint', <pylama_pylint.main.Linter object at 0x1074eef50>), ('mccabe', <pylama.lint.pylama_mccabe.Linter object at 0x106fa4390>)], linters_params={u'pep8': {u'max_line_length': 119}, u'pylint': {u'max_line_length': 119}, u'mccabe': {u'max-complexity': 10}}, options='', paths=['my_app'], report=None, select=[], skip=[<_sre.SRE_Pattern object at 0x1079ac618>, <_sre.SRE_Pattern object at 0x1079ac8a0>, <_sre.SRE_Pattern object at 0x1079aa8b8>], sort=[], verbose=True)
File is reading: my_app/__init__.py
Run pep8 {u'max_line_length': 119}
Run pylint {u'max_line_length': 119}
Problem importing module classes.py: cannot import name InferenceContext
Problem importing module classes.pyc: cannot import name InferenceContext
Run mccabe {u'max-complexity': 10}

Any help would be appreciated... Thanks!

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30444767-pylama-doesn-t-work-with-latest-version-of-pylint?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

Reduce duplicate messages?

Hello, pylama is very useful!

However, I have noticed that if I use pylint with pyflakes and pep8, there are many duplicate messages. Both pylint and pyflakes produce errors like E0602, which uses the same error number but slightly different messages. On the other hand, both pylint and pep8 generate things like a "line too long" message, but use different error codes (C0301 for pylint and E501 for pep8).

It would be great if, when using more than one linter, duplicates like the above could be reduced to just a single warning. Perhaps even the order of the linters could dictate which linter "wins" if more than one report the same message?

Pylama failes to check file on other drive on Windows

Hello!

I have Windows 8 x64. I installed Miniconda2 on drive C: (C:\Miniconda2). Then I installed pylama using pip (pip install pylama). After that I tried to check file on drive E:

pylama E:\test_file.py

I got error:

ValueError: File is on drive E: start on drive C:

If I cd to E drive and than run file check then works fine. But because of this pylama doesn't works correctly in pylama-linter plugin for atom.

How can I fix it?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/32389415-pylama-failes-to-check-file-on-other-drive-on-windows?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

Weird pylint format / default with all info

What is the "pylint" format based on?

The old default for pylint itself was "pylint --msg-template='{msg_id}:{line:3d},{column}: {obj}: {msg}'" and now is "{C}:{line:3d},{column:2d}: {msg} ({symbol})" (https://docs.pylint.org/en/1.6.0/output.html).

I would like to use pylama's pylint format, but it is missing the column.

    pattern = "%(filename)s:%(lnum)s:%(col)s: %(text)s"
    if options.format == 'pylint':
        pattern = "%(filename)s:%(lnum)s: [%(type)s] %(text)s"

What do you think about specifying --pattern?
And what about a default format that includes all information? (with type and col) :)

Should pylama_pylint be in the requirements?

Should pylama_pylint be in the requirements (preferably requirements-test.txt)? I had to install it manually, in other case I got warnings WARNING:root:Linter pylint not found on every tests run.

If so, I can make a pull request adding this package to requirements.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36983106-should-pylama_pylint-be-in-the-requirements?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

pylint linter is ignored when pylama is run under pytest

i have this in tox.ini

[pytest]
norecursedirs = build .* .env media static deployment
addopts = -vvl --pylama
DJANGO_SETTINGS_MODULE=pdt.settings_test

[pylama]
format = pep8
skip = */.tox/*,*/.env/*,pdt/core/migrations/*
linters = pylint,mccabe,pep8,pep257
ignore = F0401,C0111,E731,D100

[pylama:pep8]
max_line_length = 120

when i run tests:

─[0] <git:(master 3b9152f✱✈) > py.test tests
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/vagrant/workspace/pdt/.env/bin/python3
cachedir: /home/vagrant/workspace/pdt/.cache
rootdir: /home/vagrant/workspace/pdt, inifile: tox.ini
plugins: pep257, cache, pep8, django, pylama, cov
collected 7 items 

tests/__init__.py SKIPPED
tests/conftest.py SKIPPED
tests/api/__init__.py SKIPPED
tests/api/test_api.py SKIPPED
tests/api/test_api.py::test_migration_filter_exclude_status PASSED
tests/api/test_api.py::test_migration_filter_status PASSED
tests/api/test_api.py::test_migration_filter_ci_project PASSED

======================================================================================= 3 passed, 4 skipped in 0.85 seconds =======================================================================================

but when i run pylama separately:

└─[0] <git:(master 3b9152f✱) > pylama tests                
tests/conftest.py:19:23: W0622 Redefining built-in 'type' [pylint]
tests/conftest.py:51:19: W0621 Redefining name 'ci_project_name' from outer scope (line 39) [pylint]
tests/conftest.py:51:36: W0621 Redefining name 'ci_project_description' from outer scope (line 45) [pylint]
tests/conftest.py:69:50: W0621 Redefining name 'ci_project' from outer scope (line 51) [pylint]
tests/conftest.py:69:13: W0621 Redefining name 'instance_name' from outer scope (line 57) [pylint]
tests/conftest.py:69:28: W0621 Redefining name 'instance_description' from outer scope (line 63) [pylint]
tests/conftest.py:71:0: C0301 Line too long (111/100) [pylint]
tests/conftest.py:87:12: W0621 Redefining name 'release_name' from outer scope (line 75) [pylint]
tests/conftest.py:87:26: W0621 Redefining name 'release_date' from outer scope (line 81) [pylint]
tests/conftest.py:111:9: W0621 Redefining name 'case_id' from outer scope (line 93) [pylint]
tests/conftest.py:111:48: W0621 Redefining name 'ci_project' from outer scope (line 51) [pylint]
tests/conftest.py:111:30: W0621 Redefining name 'case_description' from outer scope (line 105) [pylint]
tests/conftest.py:111:18: W0621 Redefining name 'case_title' from outer scope (line 99) [pylint]
tests/conftest.py:111:60: W0621 Redefining name 'release' from outer scope (line 87) [pylint]
tests/conftest.py:114:0: C0301 Line too long (107/100) [pylint]
tests/conftest.py:121:28: W0108 Lambda may not be necessary [pylint]
tests/conftest.py:144:27: W0108 Lambda may not be necessary [pylint]
tests/conftest.py:156:28: W0108 Lambda may not be necessary [pylint]
tests/conftest.py:166:28: W0108 Lambda may not be necessary [pylint]
tests/api/test_api.py:31:0: C0330 Wrong hanging indentation.             'id': mr2.id,             ^   | [pylint]
tests/api/test_api.py:32:0: C0330 Wrong hanging indentation.             'ci_project': migration.case.ci_project.name,             ^   | [pylint]
tests/api/test_api.py:33:0: C0330 Wrong hanging indentation.             'instance': mr2.instance.name,             ^   | [pylint]
tests/api/test_api.py:34:0: C0330 Wrong hanging indentation.             'status': mr2.status,             ^   | [pylint]
tests/api/test_api.py:35:0: C0330 Wrong hanging indentation.             'datetime': equals_any,             ^   | [pylint]
tests/api/test_api.py:36:0: C0330 Wrong hanging indentation.             'log': mr2.log},             ^   | [pylint]
tests/api/test_api.py:37:0: C0330 Wrong continued indentation.         ]         ^                    | [pylint]

Ability to use config file with hook

Hi,

We're keeping .ini file within repository, and it would be great, if we could use this ini file with hook installed by pylama in git repository

Enhancement: record suppress patterns in an external file

Hi,
this is more like a wishlist item.

I would love to see a way to suppress warnings by specifying that in an
external file. There are often situation when I would like to suppress a
PyLint warning based on a filename and/or content pattern. Putting active
comments into the source is just not an option for me.

For example, I would like to suppress the "too many public methods"
recommendation for the "TestCase" content pattern or suppress more specific
warnings at particular locations after I already considered alternatives.

I just stumbled upon this and thought this would be a good place to post this
because you describe the suppression through comments in the README.
Python-mode really improved my workflow. Thanks, and keep up the good work.

[Errno 2] No such file or directory:

I just tried to ammend commit with some files being removed and got this error message both in pylama 1.5.x and pylama 2.0.2 from commit hook:

,,,
some_file.py:0:0: [Errno 2] No such file or directory: 'some_file.py'
,,,

Also, commiting as a new commit gave the same error.

pep257 error codes

pep257 now has error codes support since its pull request #53 has been merged.

It would be nice to expose the new pep257 --ignore option into pylama to allow user to silent some pep257 errors, as it's currently done with lint_ignore option.

Incorrect memory usage on large projects

Why are pylama collects all analysis results in memory? If run it on large project, OS will kill pylama due a memory leak.
Profiling result of pympler for little (requests-2.12.1, size: 2Mb, files:149) project:

from pylama.main import shell
from pympler.tracker import SummaryTracker

def pylama_start2():
    errors2 = shell('-l pylint ../perf_test/requests-2.12.1/'.split(), error=False)
    print(len(errors2))

tracker = SummaryTracker()
pylama_start2()
tracker.print_diff()

Messages count: 9638

                                     types |   # objects |   total size
========================================== | =========== | ============
                              <class 'dict |      599403 |    179.31 MB
                              <class 'list |      503739 |     41.20 MB
                               <class 'str |      204213 |     15.59 MB
         <class 'astroid.node_classes.Name |      138042 |      7.37 MB
                               <class 'int |      249007 |      6.65 MB
                             <class 'tuple |       82360 |      5.12 MB
                               <class 'set |        7235 |      3.71 MB
                <class 'tokenize.TokenInfo |       42623 |      3.58 MB
        <class 'astroid.node_classes.Const |       52532 |      2.81 MB
     <class 'astroid.scoped_nodes.ClassDef |       47774 |      2.55 MB
    <class 'astroid.node_classes.Arguments |       46631 |      2.49 MB
  <class 'astroid.scoped_nodes.FunctionDef |       46535 |      2.49 MB
                         <class 'traceback |       36915 |      2.25 MB
   <class 'astroid.node_classes.AssignName |       39898 |      2.13 MB
         <class 'astroid.node_classes.Call |       31350 |      1.67 MB
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40035006-incorrect-memory-usage-on-large-projects?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

Not able to select files which don't end with '.py'

I have a project, where some python files/scripts do not end with '.py'.
Is it possible to include these files in my pytest.ini/pylama.ini

I tried pylama by explicitely selecting the file e.g. pylama path/to/file, but pylama still ignores it.
When I rename the file to have a '.py' suffix pylama works.

Can't continue comment after noqa

I want to write additional comment text after # noqa:

skip_this_code()  # noqa pylint:disable=...

But pylama ignores such comment and produces a warning. FYI flake8 accepts this comment and skips the line with such comment.

Mercurial hooks fails when working with virtualenvs

I have a mercurial installed globaly and pylama in a virtualenv.
When installing mercurial hooks they fail since mercurial can't import the hook and fails.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3239866-mercurial-hooks-fails-when-working-with-virtualenvs?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

AttributeError: 'Call' object has no attribute 'starargs'

Programs version.

$ python --version
Python 2.7.10

$ pip2 freeze | grep "pylama\|pylint"
pylama==7.0.6
pylama-gjslint==0.0.7
pylama-pylint==2.1.1
pylint==1.4.4

$ python3 --version
Python 3.4.3+

$ pip3 freeze | grep "pylama\|pylint"
pylama==7.0.6
pylama-gjslint==0.0.7
pylama-pylint==2.1.1
pylint==1.4.4

Error when using Pylint linter.

$ pylama -l pylint subdown.py                                                                                                    
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pylint/lint.py", line 910, in get_ast
    return MANAGER.ast_from_file(filepath, modname, source=True)
  File "/usr/local/lib/python3.5/dist-packages/astroid/manager.py", line 112, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/usr/local/lib/python3.5/dist-packages/astroid/builder.py", line 134, in file_build
    module = self._data_build(data, modname, path)
  File "/usr/local/lib/python3.5/dist-packages/astroid/builder.py", line 177, in _data_build
    module = rebuilder.visit_module(node, modname, node_file, package)
  File "/usr/local/lib/python3.5/dist-packages/astroid/rebuilder.py", line 148, in visit_module
    newnode.body = [self.visit(child, newnode) for child in node.body]
  File "/usr/local/lib/python3.5/dist-packages/astroid/rebuilder.py", line 148, in <listcomp>
    newnode.body = [self.visit(child, newnode) for child in node.body]
  File "/usr/local/lib/python3.5/dist-packages/astroid/rebuilder.py", line 161, in visit
    return self._transform(visit_method(node, parent))
  File "/usr/local/lib/python3.5/dist-packages/astroid/rebuilder.py", line 427, in visit_discard
    newnode.value = self.visit(node.value, newnode)
  File "/usr/local/lib/python3.5/dist-packages/astroid/rebuilder.py", line 161, in visit
    return self._transform(visit_method(node, parent))
  File "/usr/local/lib/python3.5/dist-packages/astroid/rebuilder.py", line 331, in visit_callfunc
    if node.starargs is not None:
AttributeError: 'Call' object has no attribute 'starargs'
subdown.py:1:0: F0002 <class 'AttributeError'>: 'Call' object has no attribute 'starargs' [pylint]

WARNING:root:Linter `pylint` not found. and other unexpected behaviour

I am not able to use pylint linter.

I made a virtualenv and run the tests

git clone https://github.com/klen/pylama.git
cd pylama
mkvirtualenv pylama
python setup.py develop
python setup.py test

There is this warning "WARNING:root:Linter pylint not found." because pylama/lint/pylama_pylint is missing.

There is also "dummy.py:15:80: E501 line too long (91 > 79 characters) [pep8]" which indicates, that tox.ini is either not read or the pep8 config max_line_length = 100 does not impact anything.

I have also problems to setup vim with python-mode, where you stated that one should create a pylama.ini

Clarify license for Debian packaging

Currently I am working on creating Debian package for pylama (https://bugs.debian.org/779449). However, the content of pylama/__init__.py is confused. The comment string says it is BSD license, but the LICENSE file is LGPL-3+.

    """
Code audit tool for python.
:copyright: 2013 by Kirill Klenov.
:license: BSD, see LICENSE for more details.
"""

__version__ = "7.0.9"
__project__ = "pylama"
__author__ = "Kirill Klenov <[email protected]>"
__license__ = "GNU LGPL"

Please help to clarify the actual license of this package by removing other license name/text in pylama so that we can work on Debian packaging, thanks.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/34617584-clarify-license-for-debian-packaging?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

A noqa for specific warnings/errors per block/line

It would be nice if we could ignore warnings and errors on a per block or per line basis much like # noqa at the end of a line for example.

Use case:

  • Ignore a block of code (a function) that's considered by mccabe to be "too complex" but you don't have the time to fix it right now.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1561076-a-noqa-for-specific-warnings-errors-per-block-line?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

pylint - how use it?

I have installed pylama_pylint but it seems that when running pylama it isn't run.

Do I need to do something to get it running?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36596728-pylint-how-use-it?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

setup_logger gets called too late (after config parsing only)

So the LOGGER is not configured to output info messages during config parsing.

There could be a setup_early_logger method additionally?!

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35452264-setup_logger-gets-called-too-late-after-config-parsing-only?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

settings overwriting eachother

I have the following lines in my pylama.ini file
[pylama:*/init.py]
ignore = W0611

[pylama:bla/init.py]
ignore = E402,W0611

On one machine this works as expected (W0611 is ignored for all init.py files, while bla/init.py also ignores E402). But when the same code is checked on a different machine, with the same pylama version, it causes E402 errors to be found for bla/init.py.

PyFlakes 1.1.0 support?

PyFlakes 1.1.0 is out and Pylama is throwing the following error:

Traceback (most recent call last):
  File "/home/jsivak/projects/beat_matrix_checker_ve/bin/pylama", line 7, in <module>
    from pylama.main import shell
  File "/home/jsivak/projects/beat_matrix_checker_ve/lib/python2.7/site-packages/pylama/main.py", line 8, in <module>
    from .config import parse_options, CURDIR, setup_logger
  File "/home/jsivak/projects/beat_matrix_checker_ve/lib/python2.7/site-packages/pylama/config.py", line 12, in <module>
    from .lint.extensions import LINTERS
  File "/home/jsivak/projects/beat_matrix_checker_ve/lib/python2.7/site-packages/pylama/lint/extensions.py", line 35, in <module>
    LINTERS[entry.name] = entry.load()()
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2379, in load
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2396, in require
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 833, in resolve
pkg_resources.ContextualVersionConflict: (pyflakes 1.1.0 (/home/jsivak/projects/beat_matrix_checker_ve/lib/python2.7/site-packages), Requirement.parse('pyflakes==1.0.0'), set(['pylama']))

Not sure if the requirements for Pylama just need to be updated or if there is some testing that Pylama needs to do to support Pyflakes 1.1.0.

When I manually update the METADATA file in my virtualenv's lib/python2.7/site-packages/pylama-7.0.7.dist-info directory:
from:
Requires-Dist: pyflakes (==1.0.0)
to:
Requires-Dist: pyflakes (>=1.0.0)

everything seems to work.

Results with pyflakes are different for each execution

My environment:

* Python 3.5.1
* pylama 7.0.9
* pylama-pylint 2.2.1
* pylint 1.5.4

My Test:

from os import path


def main() :
    """Some docstring."""
    if path.exists('/tmp'):
        return True



if __name__ = '__main__':
    main()

Executed command:

pylama -l mccabe,pyflakes,pylint,pep8,pep257 -F --sort E,W,D -f pep8 test.py

Expected result:

test.py:11:0: E0001 invalid syntax [pylint]
test.py:11:13: invalid syntax [pyflakes]
test.py:1:1: D100: Missing docstring in public module [pep257]
test.py:4:11: E203 whitespace before ':' [pep8]
test.py:11:1: E303 too many blank lines (3) [pep8]

Real result:
Set of entries from expected result. Very rarely I'm able to see all expected results. Problem disappears when pyflakes plugin is disabled.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/36101599-results-with-pyflakes-are-different-for-each-execution?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394650&utm_medium=issues&utm_source=github).

Inconsistent formatting with --format=pep8

I have noticed that the formatting for "--format pep8" is inconsistent, because
it will not have a type field (E) and number:

Given t.py:

 = meh
% pylama -l  mccabe,pep8,pyflakes,pep257 --format=pep8 t.py
t.py:1:2: E111 indentation is not a multiple of four [pep8]
t.py:1:2: E113 unexpected indentation [pep8]
t.py:1:1: unexpected indent [pyflakes]

This makes it more difficult to parse (e.g. using Vim's errorformat).

With --format=pylint:

% pylama -l  mccabe,pep8,pyflakes,pep257 --format=pylint t.py
t.py:1: [D] D100: Missing docstring in public module [pep257]
t.py:1: [E] Invalid syntax: = meh [mccabe]
t.py:1: [E] unexpected indent [pyflakes]

(The same file with the "pylint" format gets different errors, which appears to
be a separate issue?! pep257 and mccabe is used here, but pep8 is not.
That happens when using pyflakes, which throws a SyntaxError from

tree = compile(code, path, "exec", _ast.PyCF_ONLY_AST)
, which causes pylama to abort. It does not depend on the format, but in which order linters get run)

pep257 breaks other linters

On python 2.7.3 / 3.2 / 3.3 pep257 seems to disable other linters: pep8, pyflakes, mccabe
On python 3.4 other linters seem to work.

pylama.ini:

[pylama]
linters = pep8,pyflakes,mccabe,pep257

Specify line length for all linters.

I would like to set my line length to 120 as opposed to 79.

It seems that pylama has no global option to specify line length config.
When running pep8 it is ignoring the global pep8 config file.

add supports multiple folders path as pylama input

flake8 supports multiple folders as input. this is very useful if you have several directories on the root directory

root_directory:
     pylama.ini
     setup.cfg
     setup.py
     app1/
     app2/
     app3/

It would be nice if I could run:

pylama app1 app2 app3

instead of

pylama app1 
pylama app2 
pylama app3 

Absolute file path for output

Feature Request:
Can you provide an option to output the absolute file path of the files?

Problem:
We use PyCharm for the python development. There you can run external tools like pylama. In the settings you can add a filter for the filepath, linenumber and column. This create clickable links to the files in the output of the external tools. Unfortunately this works only if the filepath is absolute.

Is it possible to add this option?

Pylama should also use config sections for linters (e.g. "[pep8]")

The following section (e.g. in tox.ini) should also apply to the pep8 linter in pylama:

[pep8]
ignore = E501

But it seems that only [pylama] sections are honored, at least with the pep8 linter.

Having to specify both a [pep8] and [pylama] section makes using pylama locally more intrusive (since the project might not use it, and therefore does not care about the added section).

The same applies to flake8 btw: it also does not use the [pep8] section, but requires you to add a [flake8] one.

Therefore I can imagine that this in done on purpose, since it allows you to treat the meta linters different?!

Does pylama treat all linters this way, or does it depend on the linters interface (i.e. some linter reads its config always)?

What about enabling using the linters setting by default and having a setting for [pylama] to disable this (changed) behavior?

I would say that a [pylama] section would still overwrite settings from [pep8] then.

strange cache behavior

I've got strange behavior with cache (pytest-cache integration fails i guess):

└─[1] <git:(master 3b9152f✱) > py.test pdt tests
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/vagrant/workspace/pdt/.env/bin/python3
cachedir: /home/vagrant/workspace/pdt/.cache
rootdir: /home/vagrant/workspace/pdt, inifile: tox.ini
plugins: pep257, cache, pep8, django, pylama, cov
collected 27 items 

pdt/__init__.py SKIPPED
pdt/settings.py SKIPPED
pdt/settings_build.py SKIPPED
pdt/settings_deployment.py SKIPPED
pdt/settings_local.py SKIPPED
pdt/settings_test.py SKIPPED
pdt/urls.py SKIPPED
pdt/wsgi.py SKIPPED
pdt/api/__init__.py SKIPPED
pdt/api/admin.py SKIPPED
pdt/api/models.py SKIPPED
pdt/api/urls.py SKIPPED
pdt/api/views.py SKIPPED
pdt/api/migrations/__init__.py SKIPPED
pdt/core/__init__.py SKIPPED
pdt/core/admin.py SKIPPED
pdt/core/models.py PASSED
pdt/core/views.py SKIPPED
pdt/core/migrations/0001_initial.py SKIPPED
pdt/core/migrations/__init__.py SKIPPED
tests/__init__.py SKIPPED
tests/conftest.py FAILED
tests/api/__init__.py SKIPPED
tests/api/test_api.py SKIPPED
tests/api/test_api.py::test_migration_filter_exclude_status PASSED
tests/api/test_api.py::test_migration_filter_status PASSED
tests/api/test_api.py::test_migration_filter_ci_project PASSED

==================================================================================================== FAILURES =====================================================================================================
________________________________________________________________________________________________________  _________________________________________________________________________________________________________

================================================================================= 1 failed, 4 passed, 22 skipped in 1.06 seconds ==================================================================================

and on next run:

└─[1] <git:(master 3b9152f✱) > py.test pdt tests
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/vagrant/workspace/pdt/.env/bin/python3
cachedir: /home/vagrant/workspace/pdt/.cache
rootdir: /home/vagrant/workspace/pdt, inifile: tox.ini
plugins: pep257, cache, pep8, django, pylama, cov
collected 27 items 

pdt/__init__.py SKIPPED
pdt/settings.py SKIPPED
pdt/settings_build.py SKIPPED
pdt/settings_deployment.py SKIPPED
pdt/settings_local.py SKIPPED
pdt/settings_test.py SKIPPED
pdt/urls.py SKIPPED
pdt/wsgi.py SKIPPED
pdt/api/__init__.py SKIPPED
pdt/api/admin.py SKIPPED
pdt/api/models.py SKIPPED
pdt/api/urls.py SKIPPED
pdt/api/views.py SKIPPED
pdt/api/migrations/__init__.py SKIPPED
pdt/core/__init__.py SKIPPED
pdt/core/admin.py SKIPPED
pdt/core/models.py SKIPPED
pdt/core/views.py SKIPPED
pdt/core/migrations/0001_initial.py SKIPPED
pdt/core/migrations/__init__.py SKIPPED
tests/__init__.py SKIPPED
tests/conftest.py FAILED
tests/api/__init__.py SKIPPED
tests/api/test_api.py SKIPPED
tests/api/test_api.py::test_migration_filter_exclude_status PASSED
tests/api/test_api.py::test_migration_filter_status PASSED
tests/api/test_api.py::test_migration_filter_ci_project PASSED

==================================================================================================== FAILURES =====================================================================================================
________________________________________________________________________________________________________  _________________________________________________________________________________________________________
tests/conftest.py:19:1: D102: Missing docstring in public method [pep257]
tests/conftest.py:22:1: D102: Missing docstring in public method [pep257]
tests/conftest.py:25:1: D102: Missing docstring in public method [pep257]

================================================================================= 1 failed, 3 passed, 23 skipped in 1.01 seconds ==================================================================================

so MORE errors appear on second run...
I guess it's because of cache.
Never had this issue with pytest-pep8, so i guess pytest-cache integration has some issues in pylama

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.