-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new declare-non-slot
error code
#9564
Add a new declare-non-slot
error code
#9564
Commits on Apr 22, 2024
-
Add "declare-non-slot" error code.
- Add test case which should report the error code. - Add test case where the error is suppressed due to __dict__ in __slots__. - Add test to detect annotation not in any base class' __slots__ - Add test against false-positive when base doesn't have __slots__ (since there is still then an instance __dict__ thanks to base) - Add test against false-positive when base has __slots__ with __dict__ entry Ignore declare-non-slots for regression_5479.py - This regression test is for "assigning-non-slot" so ignore "declare-non-slots" which also matches this example. Implement check for "declare-non-slot" and 2 new helper methods: - Add method `_check_declare_non_slot` to report "declare-non-slot" error. This method checks `node` and all bases for a valid `__slots__`, gathering the names in all `__slots__` found. If `node` has an annotation not in any `__slots__`, then "declare-non-slot" is reported. - Add helper method `_has_valid_slots` which returns True if a valid `__slots__` is found on a ClassDef (re-use logic from `_check_slots`). - Refactor `_check_redefined_slots` to split out logic for getting `__slots__` names into `_get_classdef_slots_names` helper.
Configuration menu - View commit details
-
Copy full SHA for ac43896 - Browse repository at this point
Copy the full SHA ac43896View commit details -
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Configuration menu - View commit details
-
Copy full SHA for 245be58 - Browse repository at this point
Copy the full SHA 245be58View commit details
Commits on Apr 24, 2024
-
Update pylint/checkers/classes/class_checker.py
Co-authored-by: Daniël van Noord <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fe93eaa - Browse repository at this point
Copy the full SHA fe93eaaView commit details -
Update pylint/checkers/classes/class_checker.py
Co-authored-by: Pierre Sassoulas <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 84f1a1f - Browse repository at this point
Copy the full SHA 84f1a1fView commit details -
Update pylint/checkers/classes/class_checker.py
Avoid unnecessary inference if any ancestor has __dict__ in __slots__ Co-authored-by: Pierre Sassoulas <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 09c22f8 - Browse repository at this point
Copy the full SHA 09c22f8View commit details
Commits on May 2, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b7d0ea3 - Browse repository at this point
Copy the full SHA b7d0ea3View commit details -
Configuration menu - View commit details
-
Copy full SHA for f3eede2 - Browse repository at this point
Copy the full SHA f3eede2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f35234 - Browse repository at this point
Copy the full SHA 2f35234View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0301e23 - Browse repository at this point
Copy the full SHA 0301e23View commit details -
Amend "declare-non-slot" to abort check if empty __slots__.
- An empty __slots__ is required if a class takes part in multiple inheritance, so assume this is the case if the base class has an empty __slots__ and abort the check. - Abort early if __dict__ found in any __slots__. - No need to call self._has_valid_slots in self._get_classdef_slots_names since we already call it at the start of the check. - Move definition to below E0244 for consistency, remove "'" around %r as this adds extra quotes when formatted.
Configuration menu - View commit details
-
Copy full SHA for 654fdaa - Browse repository at this point
Copy the full SHA 654fdaaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a7bb6f - Browse repository at this point
Copy the full SHA 5a7bb6fView commit details -
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Configuration menu - View commit details
-
Copy full SHA for 9ea4441 - Browse repository at this point
Copy the full SHA 9ea4441View commit details -
Configuration menu - View commit details
-
Copy full SHA for deb9d41 - Browse repository at this point
Copy the full SHA deb9d41View commit details -
Configuration menu - View commit details
-
Copy full SHA for cfd81c2 - Browse repository at this point
Copy the full SHA cfd81c2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 67b5d50 - Browse repository at this point
Copy the full SHA 67b5d50View commit details
Commits on Jun 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b346850 - Browse repository at this point
Copy the full SHA b346850View commit details -
Configuration menu - View commit details
-
Copy full SHA for 71f763e - Browse repository at this point
Copy the full SHA 71f763eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7080a86 - Browse repository at this point
Copy the full SHA 7080a86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4213b1b - Browse repository at this point
Copy the full SHA 4213b1bView commit details
Commits on Jun 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 05e0e14 - Browse repository at this point
Copy the full SHA 05e0e14View commit details