Fri, 10 Apr 2015 19:16:57 +0200
Fixed syntax checker to correctly identify VCS conflict markers. The current method was too stupid.
Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py | file | annotate | diff | comparison | revisions |
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Tue Apr 07 18:58:19 2015 +0200 +++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Fri Apr 10 19:16:57 2015 +0200 @@ -18,6 +18,10 @@ except ImportError: pass +VcsConflictMarkerRe = re.compile( + r"""^<<<<<<< .*?=======.*?>>>>>>> .*?$""", + re.MULTILINE | re.DOTALL) + def initService(): """ @@ -104,14 +108,14 @@ codestring = normalizeCode(codestring) # Check for VCS conflict markers - lineindex = 1 - for line in codestring.splitlines(): - if any(line.startswith(c * 7) for c in "<>=|"): - return [{'error': - (file_enc, lineindex, 0, "", - "VCS conflict marker found") - }] - lineindex += 1 + conflict = VcsConflictMarkerRe.search(codestring) + if conflict is not None: + start, i = conflict.span() + lineindex = 1 + codestring.count("\n", 0, start) + return [{'error': + (file_enc, lineindex, 0, "", + "VCS conflict marker found") + }] if filename.endswith('.ptl'): try: