Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py

changeset 2984
031cceaa8b01
parent 2982
556adfe76ba7
child 3004
c4bf32c791d0
equal deleted inserted replaced
2983:f2f33024b001 2984:031cceaa8b01
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. 7 Module implementing a checker for naming conventions.
8 """ 8 """
9 9
10 import collections 10 import collections
11 import ast 11 import ast
12 import re 12 import re
15 from PyQt4.QtCore import QT_TRANSLATE_NOOP, QCoreApplication 15 from PyQt4.QtCore import QT_TRANSLATE_NOOP, QCoreApplication
16 16
17 17
18 class NamingStyleChecker(object): 18 class NamingStyleChecker(object):
19 """ 19 """
20 Class implementing a checker for PEP-8 naming conventions. 20 Class implementing a checker for naming conventions.
21 """ 21 """
22 LowercaseRegex = re.compile(r"[_a-z][_a-z0-9]*$") 22 LowercaseRegex = re.compile(r"[_a-z][_a-z0-9]*$")
23 UppercaseRegexp = re.compile(r"[_A-Z][_A-Z0-9]*$") 23 UppercaseRegexp = re.compile(r"[_A-Z][_A-Z0-9]*$")
24 CamelcaseRegexp = re.compile(r"_?[A-Z][a-zA-Z0-9]*$") 24 CamelcaseRegexp = re.compile(r"_?[A-Z][a-zA-Z0-9]*$")
25 MixedcaseRegexp = re.compile(r"_?[a-z][a-zA-Z0-9]*$") 25 MixedcaseRegexp = re.compile(r"_?[a-z][a-zA-Z0-9]*$")

eric ide

mercurial