| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Also move unittest_lint in test/lint.
|
|
|
|
|
| |
We need this name so it's easier to figure out what name can be passed
to `--load-plugins`.
|
|
|
|
| |
Closes #3303
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
using configuration:
```yaml
- repo: https://github.com/asottile/pyupgrade
rev: v2.1.0
hooks:
- id: pyupgrade
args: [--py3-plus, --keep-percent-format]
exclude: ^tests/(extensions/data/|functional/|input/|regrtest_data/)
```
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This behaviour was previously removed in ac2c49867077cea9d0542560590999f2ebe00276
along with the removal of `''` to not force `pylint` load local files having the
same name as stdlib or pylint dependencies.
But we need the current working directory in sys.path in order to properly solve
relative imports.
For instance, given a package `pkg` and two modules, `pkg.A` and `pkg.B`,
pylint would not be able to import a relative import `from .B import X`
because it does not know where it can look for `.B` in the first place.
Having the current working directory in sys.path means that
`astroid.modutils.file_info_from_modpath` is still able to solve relative
imports.
At the same time, having the cwd in sys.path means that we might still load
files local to this directory during pylint's initialization.
The second part of this commit is to move `fix_import_path` before doing any
AST processing. As a side effect, this removes a nasty bug with multiple jobs
linting. Because the path was previously modified before spinning up new workers,
those new workers would have had the cwd in sys.path and as a result, they would
have been "able" to load local files from the directory, such as a malitious `astroid.py`.
|
| |
|
|
|
|
|
|
|
|
| |
Adding the current directory to `sys.path` can also mean that we're
going to load modules having the same name as stdlib modules or
astroid modules, which can break pylint.
We were doing this since 4becf6f9e596b45401680c4947e2d92c953d5e08,
but there was indication on why we were doing that.
|
|
|
|
| |
Found in #3329
|
|
|
| |
After all, if we don't use this, why should anybody else?
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Add a --fail-under <score> flag, also configurable in a `.pylintrc`file
If the final score is more than the specified score, it's considered a
success and pylint exits with exit code 0. Otherwise, it's considered
a failure and pylint exits with its current exit code based on the
messages issued.
Close #2242
|
|
|
|
|
| |
This code is not needed, since get_ast with `data` != None is only
needed for the --from-stdin feature, where get_ast is only called
once. Therefore, a cache is not needed.
|
|
|
|
|
|
|
|
|
| |
This commit adds support for disabling `line-too-long` messages
for multilines strings such as docstrings.
When a pylint disable pragma is present at the end of the docstring, it is taken
in account for the entire docstring.
Close #2957
|
|
|
|
|
|
|
|
|
| |
Exceptions raised in _ast_from_string were not properly handled in
Pylint.check. Therefore, the output of `echo for | pylint --disable=all
--enable=syntax-error --from-stdin module.py` contained a traceback.
This issue is fixed by integrating the code from _ast_from_string into
Pylint.get_ast.
|
|
|
|
|
|
|
| |
Enable syntax errors to properly surface invalid code in py3
porting mode, instead of silently swallowing them and giving
the incorrect impression that the code is valid for py3.
Closes #2956
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change prepares the code for enabling Prospector to take advantage
of running PyLint parallel.
Iterating files is moved into generator (_iterate_file_descrs) so that
parallel checking can use the same implementation (_check_file) just
by providing different kind of generator that reads the files from parent
process.
The refactoring removes code duplication that existed in PyLinter._do_check
method; checking module content from stdin had identical implementation to
checking content from a source file.
Made PyLinter.expand_files a private method.
The previous implementation of parallel linting created new PyLinter
objects in the worker (child) process causing failure when running under
Prospector because Prospector uses a custom PyLinter class
(a class inherited from PyLinter)
and PyLint naturally just creates PyLinter object. This caused linting to
fail because there is options for Prospector's IndentChecker which was not
created in the worker process.
The new implementation passes the original PyLinter object into workers
when the workers are created. See https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
Note that as Windows uses spawn method by default, PyLinter object (and
its) members need to be pickleable from now on with the exception being
PyLinter.reporter which is not passed to child processes.
The performance has remained about the same based on quick tests done with
Django project containing about 30 000 lines of code; with the old
implementation linting took 26-28 seconds with 8 jobs on quad core i7 and
24-27 seconds with the new implementation.
|
|
|
|
| |
Closes #617
|
|
|
|
| |
Close #3175
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
When enabling/disabling several messages and groups in a config
file, it can be unclear which messages are actually enabled and
which are disabled. This new command produces the final resolved
lists of enabled/disabled messages, sorted by symbol but with the
ID provided for use with `--help-msg`.
This commit includes a test, documentation, and adding myself to
the contributors list, as this is my first contribution.
|
|
|
|
| |
We no longer support Python 2 so we can remove
the compatibility code we had in place for that version.
|
|
|
|
| |
Close #2327
|
|
|
|
| |
We anticipate to have a MessageIdStore.
|
| |
|
|
|
|
|
| |
Previously, self.stats['by_module'][modname]["statement"] was
initialized to 0 and never updated once the module was processed.
|
| |
|
|
|
|
| |
Following review see : https://github.com/PyCQA/pylint/pull/2844#discussion_r281014968
|
| |
|
|
|
| |
Closes #199
|
|
|
|
| |
Close #2914
|
|
|
|
|
|
|
| |
This permit to have less cross dependency as the utils package
does not depend on anything. The checker package still depends
on reporter. Also moved classes from __init__ to their own file
in reporter.
|
|
|
|
|
| |
ReportsHandlerMixIn was importing Nodes from reporter and is
probably more suited for the reporter package anyway.
|
|
|
|
|
|
|
|
| |
Some constants were package internal but were used by multiple
packages. This created circular dependencies. By creating a
file for constants we make sure this does not happen because
we won't import everything important in this file and every
thing else can depend on it.
|
|
|
|
| |
Change with isort triggered change with black.
|
| |
|
|
|
|
|
| |
For obvious reasons. See review here :
https://github.com/PyCQA/pylint/pull/2654#discussion_r263843101
|
|
|
|
|
|
|
|
| |
There is a lot of Message related class in Utils
this warrant the creation of a new package.
See also review for burst utils.py into a package here:
https://github.com/PyCQA/pylint/pull/2654#issuecomment-470748956
|
|
|
| |
Close #2764
|
|
|
|
|
| |
pylint gained a new `--from-stdin` flag which activates stdin linting, useful for editors and similar use cases.
Closes: #1187
|
| |
|
|
|
|
| |
groups ``pylint`` knows about.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
A new optional hook for plugins is added: `load_configuration()`.
This hook is executed after configuration is loaded to allow plugins
to provide a specific configuration tailored to their purpose (e.g.
pylint-django could set up their own set of `good_names` or blacklisted
directories)
|
| |
|
|
|
|
|
| |
``implicit-str-concat-in-sequence`` detects string concatenation inside lists, sets & tuples.
It would warn on code such as `('a', 'b' 'c')`.
|