| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
| |
Closes #4736
|
|
|
|
|
| |
Closes #5058
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Based on discussion in #4787
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
|
| |
It's possible to use the python3 porting checker from
an older pylint version. But it's not evolving anymore
and was costing resource to maintain.
|
|
|
|
|
| |
We're only supporting python version > 3.6 so this became
useless configuration.
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
| |
Co-authored-by: Tiago Honorato <tiagohonorato1@gmail.com>
|
|\ |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* Change msg name to include dataclass
* Update pylint ignores
* Update tests
|
|
|
|
| |
* Add new checker consider-using-namedtuple
* Add disable for existing code base
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
| |
* Emit ``consider-using-with`` also if calls like ``open()`` are used without an assignment
|
|
|
| |
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
|
|
|
|
|
| |
* Suppress consider-using-with if used inside context manager
* Added ChangeLog entry
|
|
|
|
|
|
|
|
| |
* Implement consider-using-with check
* Fix or disable consider-using-with in codebase
* Fix ticket number in ChangeLog
* Move functional test for ``open()`` into separate testfile and exclude this test from running with PyPy
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
|
|
|
|
| |
* Fix crash min-max refactoring checker
* Small update to test
|
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: manderj <joffrey.mander+pro@gmail.com>
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
use-symbolic-message-instead was not working for message with
multiple new names and the function to get the symbol was
suboptimal. Also made the solution copy pastable.
|
| |
|
| |
|
|
|
|
|
|
| |
In the base checker, change the 'blacklisted-name' message to
'disallowed-name'. For backward compatibility, blacklisted-name is
an old_name for disallowed-name.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
See issue #3165 (#3309)
See https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Daniel Hahler <github@thequod.de>
|