Skip to content

Commit baef9ed

Browse files
committed
Merge pull request #77 from twisted/77-special-var-names
`__version__` is not a violation of the Twisted naming convention.
2 parents 502fb78 + 6e2f63f commit baef9ed

File tree

6 files changed

+20
-22
lines changed

6 files changed

+20
-22
lines changed

twistedchecker/configuration/pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function-rgx=((([a-z])|([a-z]+_[a-z]))[a-zA-Z0-9]+)$|(__[a-z]+__)$|(\_.+)$|(test
6363
# Attribute names should be in mixed case, with the first letter lower case,
6464
# each word separated by having its first letter capitalized just like method names.
6565
# And all private names should begin with an underscore.
66-
attr-rgx=(((([a-z_])|([a-z]+_[a-z]))[a-zA-Z0-9]+)|(([A-Z_][A-Z0-9_]*)))$
66+
attr-rgx=(((([a-z_])|([a-z]+_[a-z])|(__))[a-zA-Z0-9]+|(__))|(([A-Z_][A-Z0-9_]*)))$
6767

6868
# Classes are to be named in mixed case, with the first letter capitalized,
6969
# each word separated by having its first letter capitalized.

twistedchecker/functionaltests/attributename_pass.py renamed to twistedchecker/functionaltests/attributename.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@ def __init__(self):
1313
"""
1414
A init of this class
1515
"""
16+
# Bad names.
17+
self.foo_bar_zar = None
18+
self.FooBarZar = None
19+
self.a = None
20+
self._fooBar_ = None
21+
self._fooBar__ = None
22+
self.__fooBar_ = None
23+
24+
# Good names.
1625
self.fooBarZar = None
1726
self._fooBarZar = None
1827
self.foobar = None
28+
self.__foobar__ = None
29+
self.__fooBar__ = None
30+
self.__dict__ = {}
31+
self.__version__ = {}
1932
# In some cases constants are lazy initialized as instance members.
2033
self.FOOBARZAR = None
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
20:C0103
2+
21:C0103
3+
23:C0103
4+
18:C0103
5+
17:C0103
6+
19:C0103

twistedchecker/functionaltests/attributename_fail.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

twistedchecker/functionaltests/attributename_fail.result

Lines changed: 0 additions & 3 deletions
This file was deleted.

twistedchecker/functionaltests/attributename_pass.result

Whitespace-only changes.

0 commit comments

Comments
 (0)