diff options
author | Anthony Foglia <afoglia@users.noreply.github.com> | 2016-11-23 19:20:10 -0500 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-11-24 02:20:10 +0200 |
commit | 5d403d5147db9d674d23ea94c50ef8b7ae15ecf0 (patch) | |
tree | f13e22ff68ddd17a0c565e2251039e7c97db4f32 /pylint/checkers/classes.py | |
parent | 23e59c80cfcba5878b7f634464a203017ab91187 (diff) | |
download | pylint-git-5d403d5147db9d674d23ea94c50ef8b7ae15ecf0.tar.gz |
Report when __slots__ is a simple string and not a non-string container (#1171)
* Report when __slots__ is a simple string and not a non-string container
* Update ChangeLog
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 36451a143..808970f08 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -420,6 +420,10 @@ MSGS = { 'no-staticmethod-decorator', 'Used when a static method is defined without using the decorator ' 'syntax.'), + 'C0205': ('Class __slots__ should be a non-string iterable', + 'single-string-used-for-slots', + 'Used when a class __slots__ is a simple string, rather ' + 'than an iterable.'), } @@ -740,6 +744,7 @@ a metaclass class method.'} if isinstance(slots, astroid.Const): # a string, ignore the following checks + self.add_message('single-string-used-for-slots', node=node) continue if not hasattr(slots, 'itered'): # we can't obtain the values, maybe a .deque? |