diff --git a/twistedchecker/configuration/pylintrc b/twistedchecker/configuration/pylintrc index 70f03b2..5f81c4d 100644 --- a/twistedchecker/configuration/pylintrc +++ b/twistedchecker/configuration/pylintrc @@ -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. diff --git a/twistedchecker/functionaltests/attributename_pass.py b/twistedchecker/functionaltests/attributename.py similarity index 52% rename from twistedchecker/functionaltests/attributename_pass.py rename to twistedchecker/functionaltests/attributename.py index 2c0fa3e..e26794e 100644 --- a/twistedchecker/functionaltests/attributename_pass.py +++ b/twistedchecker/functionaltests/attributename.py @@ -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 diff --git a/twistedchecker/functionaltests/attributename.result b/twistedchecker/functionaltests/attributename.result new file mode 100644 index 0000000..6e4b434 --- /dev/null +++ b/twistedchecker/functionaltests/attributename.result @@ -0,0 +1,8 @@ +19:C0103 +24:C0103 +20:C0103 +22:C0103 +23:C0103 +17:C0103 +18:C0103 +21:C0103 diff --git a/twistedchecker/functionaltests/attributename_fail.py b/twistedchecker/functionaltests/attributename_fail.py deleted file mode 100644 index 30016eb..0000000 --- a/twistedchecker/functionaltests/attributename_fail.py +++ /dev/null @@ -1,18 +0,0 @@ -# enable: C0103 - -class FooClass: - """ - 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. - """ - - def __init__(self): - """ - A init of this class - """ - self.foo_bar_zar = None - self.FooBarZar = None - self.a = None diff --git a/twistedchecker/functionaltests/attributename_fail.result b/twistedchecker/functionaltests/attributename_fail.result deleted file mode 100644 index f64efab..0000000 --- a/twistedchecker/functionaltests/attributename_fail.result +++ /dev/null @@ -1,3 +0,0 @@ -18:C0103 -16:C0103 -17:C0103 diff --git a/twistedchecker/functionaltests/attributename_pass.result b/twistedchecker/functionaltests/attributename_pass.result deleted file mode 100644 index e69de29..0000000