| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
|
|
|
|
|
|
| |
When looking for nonlocal names and assignments in upper scope, also look
for AnnAssign nodes.
Close #2671
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`chained-comparison` detects boolean expressions such as `a < b and b < c` and suggests
it should be rewritten as `a < b < c`.
The current implementation is limited in two ways. First, cannot deal with existing chain
comparisons, so it would not detect the following:
`a < b < c and c < d` # should be a < b < c < d
Second, the algorithm for detecting possible chains is simplistic, and would falsely
detect the following:
`a < b < c and b < d` # no simplification possible
This change fixes both of these issues.
|
|
|
|
|
|
|
|
|
|
| |
Previously we weren't doing this because we detected a
``__getattr__`` implementation on the ``Enum`` class
(and this check is skipped for classes with ``__getattr__``),
but that is fine for Enums, given that they are inferred in a customised
way in astroid.
Close #2565
|
|
|
| |
Close #2558
|
| |
|
|
|
|
|
|
|
|
| |
Fixed issue where ``if`` statements with nested ``if`` statements
were incorrectly being flagged as ``no-else-raise`` in some cases and
not being flagged as ``no-else-raise`` in other cases. Added tests
for verification and updated pylint source files to eliminate newly
exposed warnings.
|
|
|
|
|
|
| |
understanding `contextlib.asynccontextmanager`
Close #2440
|
| |
|
|
|
|
|
|
|
|
| |
Used when an operation is done against an exception, but the operation
is not valid for the exception in question. Usually emitted when having
binary operations between exceptions in except handlers.
Close #2494
|
|
|
|
|
|
|
|
|
|
| |
define ``__reversed__``
One such object would be an enum class, for which ``__reversed__`` yields each individual enum.
As such, the check for ``bad-reversed-sequence`` needs to not differentiate between classes
and instances when it comes for checking of ``__reversed__`` presence.
Close #2598
|
|
|
|
| |
- fix #2610 (#2611)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this commit literal-comparison did not fire for the following
comparisons
x is 0
x is 1
due to a subtle bug in the checker implementation. The skip condition
in the ``ComparisonChecker._check_literal_comparison`` was
literal.value in (True, False, None)
which holds for True/False/None _as well as_ 0 and 1, since 0 == False
and 1 == True.
|
|
|
|
|
|
| |
iteration.
Close #2533
|
|
|
|
|
| |
``implicit-str-concat-in-sequence`` detects string concatenation inside lists, sets & tuples.
It would warn on code such as `('a', 'b' 'c')`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
deprecated method
Previously we were using the fully qualified name, which we still do, but the fully
qualified name for some ``unittest`` deprecated aliases leads to a generic
deprecation function. Instead on relying on that, we now also rely on the attribute
name, which should solve some false positives.
Close #1653
Close #1946
|
|
|
|
|
|
|
|
| |
The regex was adapted so that we either stop at one of `;` or `#`, or at the end
of the line. This should improve the situation a little bit when dealing with the
flags of other linters.
Close #2485
|
| |
|
|
|
|
|
|
| |
values, prefer boolyness instead
Close #2527
|
|
|
|
| |
#2226
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following expression from test_good_comprehension_checks will fail
to execute, because the list element from the range function has the
type int and int has no len method:
```
>>> [data for data in range(100) if len(data)]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <listcomp>
TypeError: object of type 'int' has no len()
```
Use the built-in `abs` method instead of the `len` method to make the
test case a little bit more realistic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several files in pylint/test/functional have Windows newlines (CRLF)
instead of Unix newlines (LF). To list these files, run:
```
find . -type f -exec file "{}" ";" | grep CRLF
```
This commit corrects the line endings of the file that the following
commit will touch by running following command:
```
perl -pi -e 's/\r\n/\n/g' pylint/test/functional/using_constant_test.py
```
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is per assignment elements
Nested assignment tuples can each have a single starred assignment, as in the
following example:
((a, *b), *c) = ...
The check was previously unflattening the occurrences of Starred nodes,
resulting in a total number of 2 Starred nodes for the given
assignment tuple, while in fact there is just one starred node
for the first tuple, followed by a separate second starred node.
Close #2513
|
|
|
|
|
|
| |
Don't suggest enumerate when defining `__iter__` and operating on the underlying class
Closes #2477
|
|
|
|
|
|
| |
Similar to simplifiable-if-statement, it finds trivial ternary
statements and suggested replacing them.
Paired-with: Richard Goodman <richardg@brandwatch.com>
|
|
|
|
| |
Close #2459
|
|
|
|
|
|
|
|
|
| |
This used to assume that the initial part of a pragma line might have
been a comment, but in practice in can be a bunch of control pragmas
for different linters, which in turn results in pylint's pragma control
no longer applying when it follows those pragma controls.
Close #2297
|
|
|
|
|
|
| |
options.
Close #2488
|
|
|
|
|
|
|
| |
This new check is emitted whenever a duplicate string formatting argument
is found.
Close #497
|
|
|
|
|
|
|
|
| |
The reason for that is that the function calls actually are returning
something, a future object that needs to be consumed through the event loop,
so emitting this check for coroutines is wrong.
Close #1715
|
|
|
|
|
|
|
|
| |
emit for sequence based checks
This was more of an heuristic than actual an useful check, so let's get rid of it.
Close #2473
|
| |
|
|
|
|
| |
Close #2313
|
| |
|
|
|
|
|
|
|
|
| |
When pylint encounters unused imports in scopes (e.g. functions),
it used to emit `unused-variable`. This is somewhat confusing, as those
names are not necessarily variables, so instead let's emit the more
obvious `unused-import`.
Close #2421
|
|
|
|
| |
Close #996
|
| |
|
|
|
|
| |
Close #2369
|
|
|
|
| |
be easier to grasp
|
|
|
|
| |
Close #2434
|
|
|
|
|
|
| |
``raising-non-exception``
Close #2431
|
|
|
|
|
|
| |
change code to ignore not-an-iterable
incorporate review comments
|
|
|
|
|
|
|
|
| |
and ``used-before-assignment`` with nonlocal keyword usage.
incorporate review comments
fix existing test case
|
| |
|
| |
|
|
|
|
|
|
| |
attribute
Close #2411
|