Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

changeset 6235
0e6a395ecfe8
parent 6188
5a6ae3be31e6
child 6264
04a671fa4adb
equal deleted inserted replaced
6234:fb1f9e681848 6235:0e6a395ecfe8
101 endPos = line.rfind(endComment) 101 endPos = line.rfind(endComment)
102 if endPos >= 0: 102 if endPos >= 0:
103 comment = comment[:endPos] 103 comment = comment[:endPos]
104 flags = [f.strip() for f in comment.split() 104 flags = [f.strip() for f in comment.split()
105 if (f.startswith("__") and f.endswith("__"))] 105 if (f.startswith("__") and f.endswith("__"))]
106 flags += [f.strip().lower() for f in comment.split()
107 if f in ("noqa", "NOQA")]
106 return flags 108 return flags
107 109
108 110
109 def ignoreCode(code, lineFlags): 111 def ignoreCode(code, lineFlags):
110 """ 112 """
117 @return flag indicating to ignore the code 119 @return flag indicating to ignore the code
118 @rtype bool 120 @rtype bool
119 """ 121 """
120 if lineFlags: 122 if lineFlags:
121 123
122 if "__IGNORE_WARNING__" in lineFlags: 124 if "__IGNORE_WARNING__" in lineFlags or \
125 "noqa" in lineFlags:
123 # ignore all warning codes 126 # ignore all warning codes
124 return True 127 return True
125 128
126 for flag in lineFlags: 129 for flag in lineFlags:
127 # check individual warning code 130 # check individual warning code

eric ide

mercurial