From 04a9b8ca395989fb1672d279be47ad6ba0c808f1 Mon Sep 17 00:00:00 2001 From: Mukilan Thiyagarajan Date: Wed, 31 Jan 2024 11:20:36 +0530 Subject: [PATCH] Fix bugs in `mach test-tidy` (#31232) * mach: test-tidy should return 1 for failure Signed-off-by: Mukilan Thiyagarajan * fix lint issues Signed-off-by: Mukilan Thiyagarajan * mach: tidy should allow spec links with trailing text Signed-off-by: Mukilan Thiyagarajan --------- Signed-off-by: Mukilan Thiyagarajan --- components/config/prefs.rs | 2 +- python/servo/platform/base.py | 4 +--- python/servo/testing_commands.py | 2 +- python/tidy/tidy.py | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/config/prefs.rs b/components/config/prefs.rs index 61ca551c1d1..f1854581371 100644 --- a/components/config/prefs.rs +++ b/components/config/prefs.rs @@ -473,7 +473,7 @@ mod gen { enabled: bool, }, testing: { - /// Enable a non-standard event handler for verifying behavior of media elements during tests. + /// Enable a non-standard event handler for verifying behavior of media elements during tests. enabled: bool, } }, diff --git a/python/servo/platform/base.py b/python/servo/platform/base.py index b654a43cd5c..e6d3e955cda 100644 --- a/python/servo/platform/base.py +++ b/python/servo/platform/base.py @@ -10,9 +10,7 @@ import os import shutil import subprocess -from typing import Dict, Optional - -from .. import util +from typing import Optional class Base: diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index f93cb75ff0c..2ca85569c58 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -218,7 +218,7 @@ class MachCommands(CommandBase): else: print("\r ✅ test-tidy reported no errors.") - tidy_failed + return tidy_failed @Command('test-scripts', description='Run tests for all build and support scripts.', diff --git a/python/tidy/tidy.py b/python/tidy/tidy.py index a837c4b8577..584291c5ccf 100644 --- a/python/tidy/tidy.py +++ b/python/tidy/tidy.py @@ -822,7 +822,7 @@ def check_spec(file_name, lines): macro_patt = re.compile(r"^\s*\S+!(.*)$") # Pattern representing a line with comment containing a spec link - link_patt = re.compile(r"^\s*///? (|https://.+)$") + link_patt = re.compile(r"^\s*///? (.*|https://.+)$") # Pattern representing a line with comment or attribute comment_patt = re.compile(r"^\s*(///?.+|#\[.+\])$")