Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py

changeset 6235
0e6a395ecfe8
parent 6188
5a6ae3be31e6
child 6247
5c677a7f7d51
equal deleted inserted replaced
6234:fb1f9e681848 6235:0e6a395ecfe8
100 endPos = line.rfind(endComment) 100 endPos = line.rfind(endComment)
101 if endPos >= 0: 101 if endPos >= 0:
102 comment = comment[:endPos] 102 comment = comment[:endPos]
103 flags = [f.strip() for f in comment.split() 103 flags = [f.strip() for f in comment.split()
104 if (f.startswith("__") and f.endswith("__"))] 104 if (f.startswith("__") and f.endswith("__"))]
105 flags += [f.strip().lower() for f in comment.split()
106 if f in ("noqa", "NOQA")]
105 return flags 107 return flags
106 108
107 109
108 def syntaxAndPyflakesCheck(filename, codestring, checkFlakes=True, 110 def syntaxAndPyflakesCheck(filename, codestring, checkFlakes=True,
109 ignoreStarImportWarnings=False): 111 ignoreStarImportWarnings=False):
329 try: 331 try:
330 lineFlags += extractLineFlags(lines[lineno].strip(), 332 lineFlags += extractLineFlags(lines[lineno].strip(),
331 flagsLine=True) 333 flagsLine=True)
332 except IndexError: 334 except IndexError:
333 pass 335 pass
334 if "__IGNORE_WARNING__" not in lineFlags: 336 if "__IGNORE_WARNING__" not in lineFlags and \
337 "noqa" not in lineFlags:
335 results.append((_fn, lineno, col, "", message, msg_args)) 338 results.append((_fn, lineno, col, "", message, msg_args))
336 except SyntaxError as err: 339 except SyntaxError as err:
337 if err.text.strip(): 340 if err.text.strip():
338 msg = err.text.strip() 341 msg = err.text.strip()
339 else: 342 else:

eric ide

mercurial