Skip to content

Commit

Permalink
Fix false positives for invalid-all-format (#4711) (#4829)
Browse files Browse the repository at this point in the history
* Fix false positives for invalid-all-format (#4711)
  • Loading branch information
kasium committed Aug 11, 2021
1 parent b8021d3 commit 47b483a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -529,3 +529,5 @@ contributors:
* Daniel van Noord (DanielNoord): contributor

* Michal Vasilek: contributor

* Kai Mueller (kasium): contributor
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -97,6 +97,10 @@ Release date: TBA

Closes #4102

* Fix false postive for ``invalid-all-format`` if the list or tuple builtin functions are used

Closes #4711


What's New in Pylint 2.9.6?
===========================
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/variables.py
Expand Up @@ -2010,7 +2010,7 @@ def _check_all(self, node, not_consumed):
if assigned is astroid.Uninferable:
return

if not isinstance(assigned, (astroid.Tuple, astroid.List)):
if not isinstance(assigned, (astroid.Tuple, astroid.List, list, tuple)):
self.add_message("invalid-all-format", node=assigned)
return

Expand Down
4 changes: 4 additions & 0 deletions tests/functional/i/invalid/invalid_all_format_valid_3.py
@@ -0,0 +1,4 @@
"""Test valid __all__ format."""
__all__ = list("CONST")

CONST = 42
4 changes: 4 additions & 0 deletions tests/functional/i/invalid/invalid_all_format_valid_4.py
@@ -0,0 +1,4 @@
"""Test valid __all__ format."""
__all__ = tuple("CONST")

CONST = 42

0 comments on commit 47b483a

Please sign in to comment.