summaryrefslogtreecommitdiff
path: root/tests/functional/c/consider
Commit message (Collapse)AuthorAgeFilesLines
* Modified all occurences of "a f-string" to "an f-string"Elazrod562023-04-202-31/+31
|
* Improve output of `consider-using-generator` message for `min()` calls with ↵Jacob Walls2023-04-162-0/+6
| | | | `default` keyword (#8582)
* [PyCQA migration] Upgrade links to the repositories in code and doc (#8514)Pierre Sassoulas2023-03-296-6/+6
|
* Add new checker `bad-chained-comparison` (#7990)Zen Lee2023-02-261-1/+1
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* [consider-using-sys-exit] Better rationale and added confidencePierre Sassoulas2022-12-281-3/+3
|
* ``consider-using-with`` now triggers for ``pathlib.Path.open`` (#7968)Gideon2022-12-212-24/+38
|
* Extend `consider-using-join` to detect non-empty separators (#7481)Levi Gruspe2022-11-132-7/+47
|
* Do not report `consider_iterating_dictionary` if bitwise operations are used ↵Dani Alcala2022-11-103-28/+52
| | | | | | | (#7743) Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Move `consider-using-augmented-assign` to `CodeStyle` extension (#7628)Marc Mueller2022-10-162-97/+0
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add ``consider-using-augmented-assign`` checker (#7514)Daniël van Noord2022-09-222-0/+97
| | | | Co-authored-by: clavedeluna <danalitovsky+git@gmail.com> Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
* Remove Python 2 code from the tests & refactor (#7320)Mark Byrne2022-08-182-6/+6
| | | | | | | - Refactor Classes which inherit from `object`. - Remove `import print_function from __future__`. - Remove assignments to `__revision__` from the functional test module when it is never used throughout the module. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* [consider-using-in] Add the proper confidence to the messagePierre Sassoulas2022-07-041-14/+14
|
* [consider-using-in] Suggest set instead of tuple for membershipPierre Sassoulas2022-07-041-14/+14
|
* Fixed misinterpreted modulo sign for ``consider-using-f-string`` (#6914)Paul Lichtenberger2022-06-112-18/+21
| | | | | | * Fixed a false positive in consider-using-f-string if the left side of a % is not a string. * consider-using-f-string: if left side of a \% does not have the attr value it can't be a str
* Change wording of use a generator message for sum/max/min (#6600)Pierre Sassoulas2022-05-132-4/+16
| | | | | Follow-up to #6595 Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* Move no-self-use to optional extension (#6448)Marc Mueller2022-05-052-2/+2
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add `comparison-of-constants` checker (#6413)omarandlorraine2022-05-042-2/+2
| | | | | Co-authored-by: Sam M W <smw@alertergroup.co.uk> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* Update tests and testoptions for PyPyDaniël van Noord2022-05-033-13/+9
|
* New checker `unnecessary-list-index-lookup` (#4525) (#5834)Tim Martin2022-03-251-1/+1
|
* Add `iterating-modified-list` checker for modified lists (#5628)orSolocate2022-02-011-1/+1
|
* Add confidence level `CONTROL_FLOW` (#5709)Jacob Walls2022-01-261-1/+1
|
* Fix false negative for `used-before-assignment` when an Except intervenes ↵Jacob Walls2022-01-152-1/+3
| | | | | between Try/Finally (#5583) Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix false positive `consider-using-dict-comprehension` when creating a dict ↵Tushar Sadhwani2021-12-302-1/+8
| | | | | | using a list of tuple where key AND value vary depending on the same condition (#5590) Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* Fix #3675: `safe_infer()` finds ambiguity among function definitions when ↵Jacob Walls2021-12-142-2/+1
| | | | | number of arguments differ (#5409) Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
* chore(*): moved changelog entry from 2.12 to 2.13Yu Shao, Pang2021-11-291-26/+26
|
* added util functions and changed code according to pr commentsYu Shao2021-11-292-7/+11
|
* Apply suggestions from code reviewyushao22021-11-291-1/+15
| | | | Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* fix(consider-interating-dictionary): fix false negativesYu Shao2021-11-292-18/+34
|
* Update functional test expected output (#5349)Daniël van Noord2021-11-2416-157/+157
| | | | | | * Add ``confidence`` to all expected functional test outputs * Make OutputLine accept end_line and end_column Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Move ``misplaced-comparison-constant`` to optional extension (#5298)Daniël van Noord2021-11-141-1/+1
| | | | | | | * Move ``misplaced-comparison-constant`` to optional extension * Update functional tests to increase coverage Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add a warning ``use-implicit-booleaness-not-comparison`` for comparison with ↵Jaehoon Hwang2021-10-173-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* 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>
* Make consider-iterating-dictionary consider membership check (#4997)Daniël van Noord2021-09-142-16/+49
|
* Extend consider-using-in for attribute accessMarc Mueller2021-09-052-1/+9
|
* Moved ``consider-using-f-string`` to `RecommendationChecker` (#4957)Daniël van Noord2021-09-031-30/+30
| | | | | Based on discussion in #4787 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Implement basic control flow checks for ``consider-using-with`` (#4929)Andreas Finkler2021-08-302-6/+98
| | | | | | | * Add some control flow checks to consider-using-with in order to handle assignments in different branches * Use existing function from ``astroid`` to determine whether two statements are exclusive * Add unit tests for new utility methods * Add ChangeLog and whatsnew entry
* Add ``Consider-using-f-string`` checker (#4796)Daniël van Noord2021-08-302-0/+137
| | | | | | | | | | | | | | | | * Add ``consider-using-f-string`` checker This adds a checker for normal strings which are formatted with ``.format()`` or '%'. The message is a convention to nudge users towards using f-strings. This closes #3592 * Update pylint code to use f-strings After adding `consider-using-f-strings` the codebase showed numerous cases of formatting which could be f-strings. This commit changes most of these to become f-strings, or adds ignores. * Apply suggestions from code review Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Suppress ``consider-using-with`` on return statementsDudeNr332021-08-151-0/+4
|
* Fix bugs in W0640 cell-var-from-loop checker (#4827)David Liu2021-08-121-1/+1
| | | | | | | | | | | | | | * Fix bugs in W0640 cell-var-from-loop checker. 1. Handle cell var appearing in node inside function. 2. Handle cell var appearing in non-trivial default argument expression. 3. Use astroid's lookup method to account for variable shadowing. * Fix cell-var-from-loop dependency on other checks. Previously, this check would have many false negatives when both unused-variable and used-before-assignment were disabled. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Add new checkers ``use-list-literal`` and ``use-dict-literal`` (#4769)Daniël van Noord2021-07-293-3/+3
| | | | | | | | | | | | | | | | | | | | | | * Add ``use-list-literal`` and ``use-dict-literal`` This adds two checks for when empty lists and dicts are created using a function call instead of their literals. This closes #4365 * Conform code to use-list-literal, use-dict-literal With addition of the use-list-literal and use-dict-literal checkers some code had to be updated. As there is a real performance difference, the literal is preferred when it is as clear as using the function call. * Conform test to use-list-literal, use-dict-literal With addition of the use-list-literal and use-dict-literal checkers some code had to be updated. As there is a real performance difference, the literal is preferred when it is as clear as using the function call. For some tests ignoring the checker seemed better for clarity of the test. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Add unspecified-encoding checker #3826 (#4753)Daniël van Noord2021-07-283-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add unspecified-encoding checker #3826 This adds an unspecified-encoding checker that adds a warning whenever open() is called without an explicit encoding argument. This closes #3826 * Update tests to conform to unspecified-encoding With addition of the unspecified-encoding checker calls of open() need an encoding argument. Where necessary this argument has been added, or the message has been disabled. This also includes small linting changes to a small number of tests. Their test-data has been updated to reflect new line numbers. * Update scripts to conform to unspecified-encoding With addition of the unspecified-encoding checker calls of open() need an encoding argument. Where necessary this argument has been added. * Update pylint to conform to unspecified-encoding With addition of the unspecified-encoding checker calls of open() need an encoding argument. Where necessary this argument has been added. Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Fix crash if a callable returning a context manager was assigned to a list ↵DudeNr332021-07-212-0/+16
| | | | | | or dict item (#4733) * Fix crash if left hand side of assignment is neither ``astroid.AssignName`` nor ``astroid.AssignAttr`` * Add ChangeLog and whatsnew entry
* Fix 4689 Exclude ``ThreadPoolExecutor`` and ``ProcessPoolExecutor`` from ↵DudeNr332021-07-202-33/+88
| | | | | | | | | | | | ``consider-using-with`` (#4721) * Do not immediately emit ``consider-using-with`` if a context manager is assigned to a variable. Instead check if it is used later on in a ``with`` block. * Enhance check to also work for tuple unpacking in assignments * Remove ``ThreadPoolExecutor`` and ``ProcessPoolExecutor`` from list of callables that trigger the ``consider-using-with`` message Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix false-positive 'consider-using-with' for ternary inside 'with' (#4679)DudeNr332021-07-061-1/+16
| | | | | As things like ternary conditionals may be used inside the items of a with, it is not enough to just check the first parent node to determine if the call is happening inside a with.
* Fix false-positive ``consider-using-with`` when using ↵DudeNr332021-07-041-0/+8
| | | | | | | | | ``contextlib.ExitStack`` (#4665) * Fix false-positive ``consider-using-with`` when using ``contextlib.ExitStack`` * Add ``whatsnew`` entry for #4654 * Python 3.6 needs special treatment - ``ExitStack`` did not inherit from ``_BaseExitStack`` until Python 3.7
* fix false positive of `consider-using-dict-items`Yu Shao, Pang2021-07-012-16/+36
|
* Move consider-using-namedtuple-or-dataclass to CodeStyle extensionMarc Mueller2021-06-122-79/+0
|
* Revert "Fix existing tests"Marc Mueller2021-06-102-26/+26
|
* Move to new extension CodeStyleCheckerMarc Mueller2021-06-102-33/+0
|