| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
`default` keyword (#8582)
|
| |
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
(#7743)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
| |
Co-authored-by: clavedeluna <danalitovsky+git@gmail.com>
Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
|
|
|
|
|
|
|
| |
- 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>
|
| |
|
| |
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
Follow-up to #6595
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
| |
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>
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
between Try/Finally (#5583)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
number of arguments differ (#5409)
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
|
| |
|
| |
|
|
|
|
| |
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| |
|
|
|
|
|
|
| |
* 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
* Update functional tests to increase coverage
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Closes #5058
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| |
|
| |
|
|
|
|
|
| |
Based on discussion in #4787
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
|
|
| |
* 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
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 ``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
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>
|
|
|
|
|
|
| |
or dict item (#4733)
* Fix crash if left hand side of assignment is neither ``astroid.AssignName`` nor ``astroid.AssignAttr``
* Add ChangeLog and whatsnew entry
|
|
|
|
|
|
|
|
|
|
|
|
| |
``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>
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
``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
|
| |
|
| |
|
| |
|
| |
|