Kaynağa Gözat

improve regex

Fu Hanxi 5 yıl önce
ebeveyn
işleme
c35b010a3f
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      tools/ci/check_build_warnings.py

+ 2 - 2
tools/ci/check_build_warnings.py

@@ -18,7 +18,7 @@ except ImportError:
     sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
     from find_build_apps import BuildItem, setup_logging
 
-WARNING_REGEX = r"^\s+(?:error|warning)"
+WARNING_REGEX = re.compile(r"^\s*(?:error|warning)", re.MULTILINE | re.IGNORECASE)
 
 IGNORE_WARNS = [
     re.compile(r_str) for r_str in [
@@ -34,7 +34,7 @@ IGNORE_WARNS = [
 
 
 def line_has_warnings(line):  # type: (str) -> bool
-    if not re.search(WARNING_REGEX, line):
+    if not WARNING_REGEX.search(line):
         return False
 
     has_warnings = True