[1/3] utils: checkstyle: Allow free form ABI/API trailers
diff mbox series

Message ID 20260903-kbingham-abi-trailers-v1-1-72ae051c912a@ideasonboard.com
State New
Headers show
Series
  • ABI: Document and support ABI and API Trailers
Related show

Commit Message

Kieran Bingham Sept. 3, 2026, 2:51 p.m. UTC
The ABI and API trailers will allow contributors to document expected
ABI and API breakage. The content may be extracted from the
abi-compliance-checker tool and will not be specifically possible to
validate precisely.

The presences of an "ABI:" or "API:" key should be permitted by the
tool.

Extend the TrailersChecker to allow and support a trailer key which does
not specify a validator, but where the Key itself is valid to exist in
the Trailers section of a commit.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 utils/checkstyle.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index f1ba1ee0ed81..b38d6831569b 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -575,6 +575,8 @@  class TrailersChecker(CommitChecker):
         'Signed-off-by': email_regex,
         'Suggested-by': email_regex,
         'Tested-by': email_regex,
+        'ABI': None,
+        'API': None,
     }
 
     trailer_regex = re.compile(r'([A-Z][a-zA-Z-]*)\s*:\s*(.*)')
@@ -593,11 +595,14 @@  class TrailersChecker(CommitChecker):
 
             key, value = match.groups()
 
-            validator = TrailersChecker.known_trailers.get(key)
-            if not validator:
+            if key not in TrailersChecker.known_trailers:
                 issues.append(CommitIssue(f"Invalid commit trailer key '{key}'"))
                 continue
 
+            validator = TrailersChecker.known_trailers[key]
+            if validator is None:
+                continue
+
             if isinstance(validator, re.Pattern):
                 valid = bool(validator.fullmatch(value))
             else: