summaryrefslogtreecommitdiff
path: root/pylint/test/functional
Commit message (Collapse)AuthorAgeFilesLines
...
* Add test that a recursion error does not happen. Close PyCQA/astroid#623Claudiu Popa2019-01-182-0/+10
|
* Add test that a recursion error does not happen any longer. Close #2463Claudiu Popa2019-01-172-0/+9
|
* Fixed a false positive for ``unused-variable`` and ``nonlocal`` assignmentsClaudiu Popa2019-01-131-0/+13
| | | | | | | When looking for nonlocal names and assignments in upper scope, also look for AnnAssign nodes. Close #2671
* Generalize `chained-comparison` (#2655)Justin Li2018-12-212-13/+38
| | | | | | | | | | | | | | | `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.
* ``no-member`` is emitted for enums when they lack a memberClaudiu Popa2018-12-112-2/+13
| | | | | | | | | | 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
* Add ``no-else-raise`` warning (R1720) (#2636)Jim Robertson2018-12-112-0/+117
| | | Close #2558
* Fix false positive Non-iterable value with async comprehensions (#2638)Pablo Galindo2018-12-111-0/+13
|
* Fix incorrect generation of ``no-else-raise`` warnings (R1705) (#2618)Jim Robertson2018-12-072-5/+45
| | | | | | | | 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.
* Fix false positive with `not-async-context-manager` caused by not ↵Claudiu Popa2018-12-063-0/+14
| | | | | | understanding `contextlib.asynccontextmanager` Close #2440
* Fix error caused by the new checkClaudiu Popa2018-11-301-1/+1
|
* Added ``wrong-exception-operation``Claudiu Popa2018-11-292-0/+21
| | | | | | | | 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
* Refactor ``bad-reversed-sequence`` to account for more objects that can ↵Claudiu Popa2018-11-281-0/+13
| | | | | | | | | | 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
* implicit-str-concat-in-sequence: Handling lines with multi-bytes characters ↵Lucas Cimon2018-11-264-0/+7
| | | | - fix #2610 (#2611)
* Fixed literal-comparison for the case of 0 and 1 (#2601)Sergei Lebedev2018-11-232-2/+16
| | | | | | | | | | | | | | | 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.
* Consider ``range()`` objects for ``undefined-loop-variable`` leaking from ↵Claudiu Popa2018-10-114-21/+25
| | | | | | iteration. Close #2533
* Adding implicit-str-concat-in-sequence check (#1655)Lucas Cimon2018-10-103-1/+31
| | | | | ``implicit-str-concat-in-sequence`` detects string concatenation inside lists, sets & tuples. It would warn on code such as `('a', 'b' 'c')`.
* ``deprecated-method`` can use the attribute name for identifying a ↵Claudiu Popa2018-10-021-0/+3
| | | | | | | | | | | | 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
* ``pylint`` is less eager to consume the whole line for pragmasClaudiu Popa2018-09-292-0/+19
| | | | | | | | 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
* Correct test fileClaudiu Popa2018-09-291-1/+0
|
* Don't suggest identity check against the interpreter's True or False builtin ↵Claudiu Popa2018-09-292-5/+6
| | | | | | values, prefer boolyness instead Close #2527
* Add test case that deprecated method is emitted for unittest methods. Close ↵Claudiu Popa2018-09-292-0/+15
| | | | #2226
* Add test case for logging-* errors for subclasses of logging.Logger. Close #960Claudiu Popa2018-09-292-1/+12
|
* Fix TypeError in test_good_comprehension_checksBenjamin Drung2018-09-281-7/+7
| | | | | | | | | | | | | | | | | 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.
* Fix Windows newlines (CRLF) to Unix newlines (LF)Benjamin Drung2018-09-281-141/+141
| | | | | | | | | | | | | | | | | | 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>
* Fix utils.is_subclass_of to be aware of complex hierarchies (#2508)Sushobhit2018-09-281-1/+16
|
* Handle recursively the count of Starred nodes in assignmentsClaudiu Popa2018-09-242-2/+5
|
* Emit ``too-many-starred-assignment`` only when the number of Starred nodes ↵Claudiu Popa2018-09-231-0/+1
| | | | | | | | | | | | | | | | 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
* No enumerate check in __iter__ (#2505)Ben James2018-09-222-1/+23
| | | | | | Don't suggest enumerate when defining `__iter__` and operating on the underlying class Closes #2477
* Added check simplifiable-if-expression (#2502)Tomer Chachamu2018-09-203-1/+32
| | | | | | Similar to simplifiable-if-statement, it finds trivial ternary statements and suggested replacing them. Paired-with: Richard Goodman <richardg@brandwatch.com>
* ``too-few-public-methods`` is not reported for ``typing.NamedTuple``Claudiu Popa2018-09-181-0/+5
| | | | Close #2459
* Partially revert commit fede47a625f40169bf839b7e8e2df643b3471635Claudiu Popa2018-09-182-18/+12
| | | | | | | | | 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
* ```too-few-public-methods`` is not reported for dataclasses created with ↵Claudiu Popa2018-09-151-0/+5
| | | | | | options. Close #2488
* Add a new check, ``duplicate-string-formatting-argument``Claudiu Popa2018-09-052-0/+17
| | | | | | | This new check is emitted whenever a duplicate string formatting argument is found. Close #497
* ``assignment-from-no-return`` is not emitted for coroutines.Claudiu Popa2018-09-053-0/+30
| | | | | | | | 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
* ``consider-using-ternary`` and ``simplified-boolean-expression`` no longer ↵Claudiu Popa2018-09-052-15/+7
| | | | | | | | 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
* Switch to Unix line endingsClaudiu Popa2018-09-041-29/+29
|
* Handle ``AstroidSyntaxError`` when trying to import a module.Claudiu Popa2018-09-042-0/+3
| | | | Close #2313
* Allow ``__module__`` to be redefined at a class level. Close #2451Claudiu Popa2018-08-311-0/+14
|
* Emit unused-import instead of unused-variable when dealing with unused importsSushobhit2018-08-312-6/+13
| | | | | | | | 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
* Handle asyncio.coroutine when looking for ``not-an-iterable`` check.Claudiu Popa2018-08-241-1/+38
| | | | Close #996
* Add test for async generators. Close #1907Claudiu Popa2018-08-242-0/+17
|
* Infer decorated methods when looking for method-hiddenClaudiu Popa2018-08-231-1/+22
| | | | Close #2369
* Update the message for assignment-from-none and assignment-from-no-return to ↵Claudiu Popa2018-08-231-2/+2
| | | | be easier to grasp
* Make sure to filter out None and Uninferable when gathering exceptionsClaudiu Popa2018-08-232-1/+10
| | | | Close #2434
* Pick the latest value from the inferred values when looking for ↵Claudiu Popa2018-08-221-0/+14
| | | | | | ``raising-non-exception`` Close #2431
* Consider tuples in exc handler for ``try-except-raise``ssolanki2018-08-212-0/+23
| | | | | | change code to ignore not-an-iterable incorporate review comments
* fix false positive ``undefined-variable``ssolanki2018-08-172-1/+27
| | | | | | | | and ``used-before-assignment`` with nonlocal keyword usage. incorporate review comments fix existing test case
* Add test for the new AsyncGenerator support. Close #2379Claudiu Popa2018-08-161-1/+14
|
* Remove occurrences of removed checksClaudiu Popa2018-08-1615-95/+11
|
* Extend the TYPE_CHECKING guard to TYPE_CHECKING name as well, not just the ↵Claudiu Popa2018-08-151-0/+7
| | | | | | attribute Close #2411