Extended the check for VCS conflict markers.

Sat, 03 Feb 2018 17:34:19 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Feb 2018 17:34:19 +0100
changeset 6107
78dabf542c6b
parent 6106
921d070cec82
child 6108
59cf5a66b0b3

Extended the check for VCS conflict markers.

Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Sat Feb 03 16:46:32 2018 +0100
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Sat Feb 03 17:34:19 2018 +0100
@@ -26,10 +26,16 @@
 except ImportError:
     pass
 
-VcsConflictMarkerRe = re.compile(
-    r"""^<<<<<<< .*?=======.*?>>>>>>> .*?$""",
-    re.MULTILINE | re.DOTALL)
-
+VcsConflictMarkerRegExpList = (
+    re.compile(
+        r"""^<<<<<<< .*?=======.*?>>>>>>> .*?$""",
+        re.MULTILINE | re.DOTALL
+    ),
+    re.compile(
+        r"""^<<<<<<< .*?||||||| .?=======.*?>>>>>>> .*?$""",
+        re.MULTILINE | re.DOTALL
+    )
+)
 
 def initService():
     """
@@ -236,14 +242,15 @@
         codestring = normalizeCode(codestring)
         
         # Check for VCS conflict markers
-        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")
-                     }]
+        for conflictMarkerRe in VcsConflictMarkerRegExpList:
+            conflict = conflictMarkerRe.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