config-clang-tidy: strip comments better
Some repositories have a Checks line with embedded comments. This
is unsupported by the python YAML parser and results in strings where
comment lines can no longer be identified because it becomes one big
paragraph. Strip these out prior to YAML processing.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I455ea4584d71d1ff94710ad8a5c02d5eabb05b82
diff --git a/tools/config-clang-tidy b/tools/config-clang-tidy
index f1aeb93..dbb0b54 100755
--- a/tools/config-clang-tidy
+++ b/tools/config-clang-tidy
@@ -189,7 +189,8 @@
return (path, {})
with open(path, "r") as f:
- return (path, yaml.safe_load(f))
+ data = "\n".join([x for x in f.readlines() if not x.startswith("#")])
+ return (path, yaml.safe_load(data))
def format_yaml_output(data: Dict[str, Any]) -> str: