| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
| |
Close #3355
|
|
|
| |
After all, if we don't use this, why should anybody else?
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds multiple checks for various Python protocols
E0304 (invalid-bool-returned): __bool__ did not return a bool
E0305 (invalid-index-returned): __index__ did not return an integer
E0306 (invalid-repr-returned): __repr__ did not return a string
E0307 (invalid-str-returned): __str__ did not return a string
E0308 (invalid-bytes-returned): __bytes__ did not return a string
E0309 (invalid-hash-returned): __hash__ did not return an integer
E0310 (invalid-length-hint-returned): __length_hint__ did not return a non-negative integer
E0311 (invalid-format-returned): __format__ did not return a string
E0312 (invalid-getnewargs-returned): __getnewargs__ did not return a tuple
E0313 (invalid-getnewargs-ex-returned): __getnewargs_ex__ did not return a tuple of the form (tuple, dict)
Close #560
|
|
|
|
|
|
|
|
| |
Because the positional only arguments can appear before the normal positional
or keyword arguments, we need to first check the positional only ones for
the purpose of bad-mcs-* and similar methods.
Close #3230
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Close #3161
|
|
|
|
|
|
| |
``class-variable-slots-conflict``
Close #3141
|
|
|
|
| |
We no longer support Python 2 so we can remove
the compatibility code we had in place for that version.
|
|
|
|
|
| |
Will permit to improve performance with less check but more
importantly simplify the message store a lot.
|
|
|
|
| |
Close #3020
|
|
|
|
|
|
|
|
|
| |
special methods
This PR prevents the emission of protected-access message when a single
underscore prefixed attribute is accessed inside a special method.
Close #1802
|
|
|
|
|
|
|
|
| |
This check is emitted when we detect that a method is overridden
as a property or a property is overridden as a method. This can indicate
a bug in the application code that will trigger a runtime error.
Close #2670
|
|
|
|
|
|
| |
This check is emitted when we detect that a defined property also
has parameters, which are useless.
Close #3006
|
| |
|
|
|
|
| |
`attribute-defined-outside-init` in dataclasses.
|
| |
|
|
|
|
| |
Close #409
|
|
|
|
| |
accordingly
|
| |
|
|
|
|
| |
Close #2909
|
| |
|
|
|
|
|
|
|
|
|
| |
It's possible to lint classes that don't have known bases (e.g. one of them
might come from a C extension), in which case we cannot make a lot of assumptions
about the class layout with respect to `__slots__`. As such, it's best to ignore
these classes from this check.
Close #2807
|
| |
|
|
|
|
|
| |
This check is emitted when ``pylint`` finds a class variable that conflicts with a slot
name, which would raise a ``ValueError`` at runtime.
|
|
|
|
|
|
|
|
| |
Take into account `__class_getitem__` from PEP 560 and fixes some false
positives for `no-self-argument` and `unsubscriptable-object`
PEP: https://www.python.org/dev/peps/pep-0560/
Close #2416
|
|
|
|
|
| |
``implicit-str-concat-in-sequence`` detects string concatenation inside lists, sets & tuples.
It would warn on code such as `('a', 'b' 'c')`.
|
| |
|
|
|
|
| |
Close #2369
|
|
|
|
| |
Skip Uninferable values from getattr
|
| |
|
|\ |
|
| |
| |
| |
| | |
can be missing. Close #2210
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
adapt existing test/input test cases to new check.
add some more positive test case for useless-object-inheritance
msg code was in conflict with existing msg.
adapt existing test cases for new checker.
|
|/
|
|
| |
Close #2177
|
|
|
|
|
|
| |
`cls`
Close #2028
|
|
|
|
|
|
| |
of keyword arguments
Closes #2022
|
|
|
|
| |
Closes #1061
|
| |
|
| |
|
| |
|
|
|
|
| |
Fixes #1923
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Previously, the greatest number of return statements in a function was
15 (checkers.typecheck). 11 is the lowest I could get it without
aggressive rewriting.
|
| |
|