2 |
2 |
3 # Copyright (c) 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
3 # Copyright (c) 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a checker for PEP-8 naming conventions for Python2. |
7 Module implementing a checker for naming conventions for Python2. |
8 """ |
8 """ |
9 |
9 |
10 import collections |
10 import collections |
11 import ast |
11 import ast |
12 import re |
12 import re |
13 import os |
13 import os |
14 |
14 |
15 |
15 |
16 class NamingStyleChecker(object): |
16 class NamingStyleChecker(object): |
17 """ |
17 """ |
18 Class implementing a checker for PEP-8 naming conventions for Python2. |
18 Class implementing a checker for naming conventions for Python2. |
19 """ |
19 """ |
20 LowercaseRegex = re.compile(r"[_a-z][_a-z0-9]*$") |
20 LowercaseRegex = re.compile(r"[_a-z][_a-z0-9]*$") |
21 UppercaseRegexp = re.compile(r"[_A-Z][_A-Z0-9]*$") |
21 UppercaseRegexp = re.compile(r"[_A-Z][_A-Z0-9]*$") |
22 CamelcaseRegexp = re.compile(r"_?[A-Z][a-zA-Z0-9]*$") |
22 CamelcaseRegexp = re.compile(r"_?[A-Z][a-zA-Z0-9]*$") |
23 MixedcaseRegexp = re.compile(r"_?[a-z][a-zA-Z0-9]*$") |
23 MixedcaseRegexp = re.compile(r"_?[a-z][a-zA-Z0-9]*$") |