summaryrefslogtreecommitdiff
path: root/tests/functional
Commit message (Collapse)AuthorAgeFilesLines
* Make ``self-cls-assignment`` check tuple assignment (#5268)Daniël van Noord2021-11-072-4/+7
| | | Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Fix crash on checking private members on ``__class__``Daniël van Noord2021-11-051-0/+9
| | | | Closes #5261
* Remove unwanted non-breaking whitespaces in comment (#5256)Pierre Sassoulas2021-11-041-1/+1
|
* Inspection for `with threading.Lock():` (#5245)Martin2021-11-032-0/+69
| | | | | | | | | | | | | | | | | | | Using `with threading.Lock():` directly has no effect. Correct usage is: ``` lock = threading.Lock() with lock: ... ``` This applies for: * threading.Lock * threading.RLock * threading.Condition * threading.Semaphore * threading.BoundedSemaphore Signed-off-by: Martin Basti <mbasti@redhat.com>
* Fix ``protected-access`` for attributes and methods of nested classes (#5232)Daniël van Noord2021-10-312-15/+91
| | | | | | | | | | | | | | | * Fix access to private function in inner class on protected-access bug * Add functional test for protected-access from inner class * Add Ikraduya to CONTRIBUTORS file * Add if statement to avoid potential bug * Fix ``protected-access`` for attributes and methods of nested classes This closes #3066 Co-authored-by: ikraduya <ikraduya@gmail.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix incorrect ``consider-using-ternary`` when condition is inferable as ↵Arianna Y2021-10-292-0/+7
| | | | | | | False (#5227) * Fix incorrect ``consider-using-ternary`` when condition is inferrable as False * Properly infer the condition in old ternary statements and suggest ``simplify-boolean-expression`` over ``consider-using-ternary`` if it is False
* Add control flow check for ``undefined-variable`` in ``if ... else``Daniël van Noord2021-10-262-1/+52
| | | | Closes #3688
* Add configuration option ``exclude-too-few-public-methods`` (#5191)Mike Fiedler2021-10-263-0/+19
| | | | | | | | | Allow excluding classes based on their ancestors from the ``too-few-public-methods`` checker. Closes #3370 Signed-off-by: Mike Fiedler <miketheman@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* Add tests for assignment expressions in function defaults (#5188)Daniël van Noord2021-10-256-1/+79
| | | | | | | | | * Add tests for assignment expressions in function defaults Ref #3688 * Upgrade astroid to 2.8.4 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Use backticks for any-all suggestion (#5207)Nick Drozd2021-10-252-7/+15
| | | | | | * Use backticks for any-all suggestion If the suggestion contains a string, then the suggestion's quotes can get mixed up with the the string's quotes.
* Add ``mixin-class-rgx`` option (#5203)Daniël van Noord2021-10-253-0/+66
| | | | | Co-authored-by: Alpha <alpha@pokesplash.net> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add extension checker that suggests any/all statements from for loops (#5196)Arianna Y2021-10-253-0/+63
| | | | | | | | | * Add extension checker that suggests any/all statements from for loops * Suggest all/not all: If there are negated conditions, we can suggest an all/not all statement to move the 'not' out of the comprehension and call it only once. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix regression for ``_is_only_type_assignment`` (#5163)Daniël van Noord2021-10-235-37/+112
| | | | | | | | | | | | | | | | * Fix regression for ``_is_only_type_assignment`` This closes #5162 * Remove references to `name` * Better tests for assignment * Move walrus tests to different file * Fix tests with incorrect typing * Update typing of `defstmt` Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Make ``used-before-assignment`` consider classes in method annotation and ↵Daniël van Noord2021-10-237-10/+74
| | | | | | | | | defaults (#5184) This closes #3771 Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix use-implicit-booleaness-not-comparison crash (#5176)Jaehoon Hwang2021-10-232-27/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix use-implicit-booleaness-not-comparison crash `use-implicit-booleaness-not-comparison` caused a crash due to `target_node` not being an instance of `NodeNG.Name` This fix will allow the checker to have a default handling when it encounters `target_node` other than `Calls`,`Name`, or `Attribute` * Added more comprehensive test for implicit_booealness_checker * Make implicit_booealness_checker to have default `variable_name` * Handle `Calls`,`Name`, or `Attribute` * Fix typing in ImplicitBooleanessChecker.base_classes_of_node * [implicit-booleaness] Add call nodes name in warnings * Use `BaseContainer` to check for empty tuple/list and use `as_string` for `Attribute` and `Name` nodes for message Using `BaseContainer` for checking for empty `tuple` and `list`. In addition, `is_base_container` checks for `FrozenSet` and `Set` as well. * Update test cases with cr concerns * Use `BaseContainer` when checking for empty list or tuple * Update `is_literal_tuple/list` to use `is_base_container` * Use `as_string` when giving out function or variable name for message. * Fix broken baseContainer test * Use safe_infer for inferencing `target_instance` * Swap opreators message * Address CR comments; no more try/catch for infer & Add more test cases * Add more test cases and changed few cases to cover more cases. * Remove `try/catch` from `safe_infer` since `safe_infer` will return `None` when it encounters exceptions. * Comparison from infer to be more explicit; using `None` instead of relying on `bool` Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix useless-super-delegation false positive when default keyword argument is ↵Nick Pesce2021-10-192-18/+38
| | | | | | | a variable. (#5157) Compare variable default args and simplify the logic of the checkers. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix double emitting of ``not-callable`` on inferrable ``properties``Daniël van Noord2021-10-192-8/+19
| | | | Closes #4426
* Fix asterisks parsing of ``mising-param-doc`` (#5175)Daniël van Noord2021-10-181-0/+36
| | | Closes #3733
* Make ``undefined-variable`` check line numbers of metaclass parametersDaniël van Noord2021-10-182-0/+11
|
* Add test for #4021Daniël van Noord2021-10-182-8/+21
| | | | This closes #4021
* From Python 3.8 onwards classes inheriting from dict are reversible (#5169)Tim Martin2021-10-175-9/+25
| | | | | | | | | | | * From Python 3.8 onwards classes inheriting from dict are reversible This generalises an earlier change to the bad-reversed-sequence checker in Python 3.8 onwards: dicts were already being treated as reversible, but so should any class inheriting from dict. Fixes #4981 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add a warning ``use-implicit-booleaness-not-comparison`` for comparison with ↵Jaehoon Hwang2021-10-177-30/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | collection literals (#5120) * Create a new checker; use-implicit-booleanness checker where it looks for boolean evaluatiion with collection literals such as `()`, `[]`, or `{}` * Fixed invalid usage of comparison within pylint package This closes #4774 * Ignore tuples when checking for `literal-comparison` Closes #3031 * Merge len_checker with empty_literal checker Moving empty literal checker with len_checker to avoid class without iterators without boolean expressions (false positive on pandas) Reference: https://github.com/PyCQA/pylint/pull/3821/files * Update `len_checker` and its class `LenChecker` to `ComparisonChecker` to reflect better usage after merging between `len_checker` and `empty_literal_checker` and its tests. * Fixed `consider_using_in` and `consider_iterating_dictionary` tests that were failing due to new empty literal checkers. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Consider Enums when checking for duplicate dictionary keys (#5155)jaydesl2021-10-162-3/+18
| | | | | * detect duplicate-key for enum members Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix py-version usage in typing extension tests (#5161)Marc Mueller2021-10-156-8/+8
|
* Use py-version for alternative union syntax check (#5160)Marc Mueller2021-10-153-2/+9
|
* Make ``undefined-variable`` flag type annotation without value assignment ↵Daniël van Noord2021-10-152-32/+68
| | | | | | | (#5158) Closes #5140 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add ``using-f-string-in-unsupported-version`` checker (#5139)Daniël van Noord2021-10-113-0/+9
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Properly identify undocumented parameters and add new message called ↵Konstantina Saketou2021-10-107-10/+141
| | | | | | | | | | | | | | | | | | | missing-any-param-doc (#5097) * Correctly identify parameters with no doc and add new message This commit fixes the problem where non documented parameters where not being identified properly. Also, it adds a new message called ``missing-any-param-doc`` for when a function has no parameter and type doc at all. Adds new test cases for the ``missing-param-doc`` and ``missing-type-doc`` messages and tests for the new message ``missing-any-param-doc``. * Replace old messages with the new one where needed Fix pylint's code where the new message where needed in other files instead of triggering both missing-param-doc and missing-type-doc. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add checkers for typing.final for Python version 3.8 or later (#5133)Mark Byrne2021-10-106-0/+39
| | | | | | | | * Add checkers for typing.final for Python version 3.8 or later - overridden-final-method - subclassed-final-class Closes #3197
* Rename `len-as-condition` to `use-implicit-booleaness-not-len` (#5132)Jaehoon Hwang2021-10-103-50/+54
| | | | | | | | | | Rename `len-as-condition` to be more general for new checker `use-implicit-booleaness-not-comparison` * Refactor `LenChecker` class -> `ImplicitBooleanessChecker`o * Rename test files/`len_checker.py`/`__init__.py` to reflect new name. * Add `len-as-condition` as `old_names` for `use-implicit-booleaness-not-len` Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add support for `ModuleNotFoundError` Python 3.6+ builtin-exception (#5106)Samuel FORESTIER2021-10-094-9/+25
|
* Reorganize regression tests (#5130)Marc Mueller2021-10-083-0/+0
| | | | * Revert folder file limit - functional tests * Move some regression tests
* Add test for typing alias in isinstance calls (#5089)Marc Mueller2021-10-072-0/+28
|
* Fix false-negative with typing.Type + typing.Callable aliases (#5090)Marc Mueller2021-10-076-28/+61
|
* Add test for crash on Compare node inference (#5057)Daniël van Noord2021-10-071-0/+9
| | | | | Closes #5048 Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Add tests for ClassDef inference regression (#5037)Daniël van Noord2021-10-072-0/+33
| | | | Closes #5030 Closes #5036
* Fix return type checkers calls on ellipses functions (#5107)Daniël van Noord2021-10-061-0/+44
| | | Closes #4736
* Fix a crash if ``str.format`` is referenced without being called (#5109)Tim Martin2021-10-061-0/+8
| | | | | Closes #5058 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Improve node info for invalid-name (#5094)Marc Mueller2021-10-053-4/+35
|
* Fix crash with AssignAttr in TYPE_CHECKING blocks (#5118)Marc Mueller2021-10-051-0/+10
|
* Improve and flatten ``unused-wildcard-import`` message (#5110)Daniël van Noord2021-10-042-4/+9
| | | | | | | | | * Improve and flatten ``unused-wildcard-import`` message Instead of reporting all unused imports, the checker now emits one single message for all unused imports with a stylized string containing all imports. This closes #3859 * Add tests for string formation
* Fix false-positive ``useless-suppression`` for ``line-too-long`` (#5077)Daniël van Noord2021-09-281-3/+9
| | | | | | | Also changes ``add_ignored_message()`` to make ``nodes`` parameter optional. Closes #4212 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix ``invalid-name`` for overwritten base ``object`` methods (#5079)Daniël van Noord2021-09-282-6/+14
|
* Fix ``useless-suppression`` for ``wrong-import-order`` (#5063)Daniël van Noord2021-09-231-0/+6
| | | | | | This also adds a new method to ``MessagesHandlerMixIn`` which adds messages to the list of the ignored messages without doing anything else. This can be used to avoid ``useless-suppression`` false positives. This closes #2366
* Fix false-positive undefined-variable with Lambda, IfExp, and := (#5044)Marc Mueller2021-09-211-1/+6
|
* Make ``consider-using-f-string`` skip `format()` with backslash (#5055)Daniël van Noord2021-09-212-25/+36
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix bug with cell-var-from-loop and kw_defaults (#5045)David Liu2021-09-202-13/+29
| | | | | | | * Fix bug with cell-var-from-loop and kw_defaults * Use more efficient generator for defaults and add issue link * Fix test output for cellvar_escaping_loop Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Require Python 3.6 for consider f-string check (#5024)Marc Mueller2021-09-172-0/+17
| | | | | | | * Require Python 3.6 for consider f-string check Co-authored-by: Ville Skyttä <ville.skytta@iki.fi> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix ``unspecified-encoding`` for ``Path.read_text()``Daniël van Noord2021-09-172-3/+4
| | | | Closes #5029
* Spelling and grammar fixesVille Skyttä2021-09-1720-23/+23
|