| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Remove unused imports for astroid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix private method hidden by ancestor class attribute
A class defined private method won't be hidden by an ancestor class private
attribute as the class will mangle the latter to avoid naming collisions.
Add tests to assert method-hidden : Although private attributes from the
parent class should not hide methods in the child class, this is not true for
protected attributes. This test ensures that ``method-hidden`` catches the
error when private attributes are not in use.
Signed-off-by: Tiago Honorato <tiagohonorato1@gmail.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| |
|
| |
|
|
|
|
| |
We can do that in python 3.6
|
| |
|
| |
|
|
|
|
| |
As we do not maintain python 3.5 it permit to simplify some code
|
| |
|
|
|
|
| |
* Closes #1927
|
| |
|
| |
|
|
|
|
| |
message emission for single underscore prefixed attributes inside special method
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| | |
class in the type to be compared for default arguments.
|
|/ |
|
|
|
|
| |
Close #3600
|
|
|
|
|
|
|
|
| |
The patch replaces `mro()` with `ancestors()` as the former is not
fully capable of generating the complete linearization when
dealing with ambiguous inferences.
Close #3527
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
No message is emitted if the overriding function provides positional or
keyword variadics in its signature that can feasibly accept and pass on
all parameters given by the overridden function.
Closes #1482
Closes #1553
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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/)
```
|
| |
|
|
|
|
| |
Close #3439
|
|
|
| |
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
|