Skip to content

Commit

Permalink
Merge pull request #105 from twisted/reserved-var-names
Browse files Browse the repository at this point in the history
Allow reserverd __XXX__ variable names.
  • Loading branch information
adiroiban committed Oct 20, 2015
2 parents e4da75a + 151d7bf commit 176309e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion twistedchecker/configuration/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function-rgx=((([a-z])|([a-z]+_[a-z]))[a-zA-Z0-9]+)$|(__[a-z]+__)$|(\_.+)$|(test
# Attribute names should be in mixed case, with the first letter lower case,
# each word separated by having its first letter capitalized just like method names.
# And all private names should begin with an underscore.
attr-rgx=(((([a-z_])|([a-z]+_[a-z]))[a-zA-Z0-9]+)|(([A-Z_][A-Z0-9_]*)))$
attr-rgx=(((([a-z_])|([a-z]+_[a-z]))[a-zA-Z0-9]+)|(([A-Z_][A-Z0-9_]*))|(__[a-zA-Z0-9][a-zA-Z0-9_]*[a-zA-Z0-9]+__)|(__[a-zA-Z0-9]__))$

# Classes are to be named in mixed case, with the first letter capitalized,
# each word separated by having its first letter capitalized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,26 @@ def __init__(self):
"""
A init of this class
"""
# Bad names.
self.foo_bar_zar = None
self.FooBarZar = None
self.a = None
self._fooBar_ = None
self._fooBar__ = None
self.__fooBar_ = None
self.___longStart__ = None
self.__longEnd___ = None

# Good names.
self.fooBarZar = None
self._fooBarZar = None
self.foobar = None
# Any __*__ name is accepted.
self.__foobar__ = None
self.__fooBar__ = None
self.__foo_bar__ = None
self.__dict__ = {}
self.__version__ = {}
self.__a__ = {}
# In some cases constants are lazy initialized as instance members.
self.FOOBARZAR = None
8 changes: 8 additions & 0 deletions twistedchecker/functionaltests/attributename.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
19:C0103
24:C0103
20:C0103
22:C0103
23:C0103
17:C0103
18:C0103
21:C0103
18 changes: 0 additions & 18 deletions twistedchecker/functionaltests/attributename_fail.py

This file was deleted.

3 changes: 0 additions & 3 deletions twistedchecker/functionaltests/attributename_fail.result

This file was deleted.

Empty file.

0 comments on commit 176309e

Please # to comment.