Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Commit afa81c3

Browse files
ulfalizergalak
authored andcommitted
check_compliance.py: Detect redundant document separators in bindings
Binding YAML documents are not concatenated together, so no '...' document separators are needed. Flag it. Signed-off-by: Ulf Magnusson <[email protected]>
1 parent a2e0ba2 commit afa81c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scripts/check_compliance.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,9 @@ def run(self):
724724
self.check_kconfig_header(fname)
725725
self.check_redundant_zephyr_source(fname)
726726

727+
if fname.startswith("dts/bindings/"):
728+
self.check_redundant_document_separator(fname)
729+
727730
if fname.endswith((".c", ".cpp", ".h", ".ld", ".py", ".rst",
728731
".yaml", ".yml")) or is_kconfig:
729732
self.check_source_file(fname)
@@ -769,6 +772,15 @@ def check_redundant_zephyr_source(self, fname):
769772
instead. The $srctree environment variable already points to the Zephyr root,
770773
and all 'source's are relative to it.""".format(match.group(1), fname))
771774

775+
def check_redundant_document_separator(self, fname):
776+
# Looks for redundant '...' document separators in bindings
777+
778+
with open(os.path.join(GIT_TOP, fname), encoding="utf-8") as f:
779+
if re.search(r"^\.\.\.", f.read(), re.MULTILINE):
780+
self.add_failure(f"""\
781+
Redundant '...' document separator in {fname}. Binding YAML files are never
782+
concatenated together, so no document separators are needed.""")
783+
772784
def check_source_file(self, fname):
773785
# Generic nits related to various source files
774786

0 commit comments

Comments
 (0)