Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py

branch
6_0_x
changeset 4208
af093b61f1cb
parent 4022
f5f42921717e
child 4231
0b38613388c9
child 4315
2ebb98e99054
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Tue Apr 07 14:19:08 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:

eric ide

mercurial