Lines Matching +full:data +full:- +full:lines

10 def main() -> None:
13 parser.add_argument("--repo", help="Path to the repository", default=".")
15 "--commit",
25 "merge", help="Merge a reference clang-tidy config"
28 "--reference", help="Path to reference clang-tidy", required=True
33 "format", help="Format a clang-tidy config"
38 "enable", help="Enable a rule in a reference clang-tidy config"
44 "disable", help="Enable a rule in a reference clang-tidy config"
48 "--drop", help="Delete the check from the config", action="store_true"
56 def subcmd_merge(args: argparse.Namespace) -> None:
70 list(all_keys_set - set(special_keys))
89 def subcmd_enable(args: argparse.Namespace) -> None:
103 def subcmd_disable(args: argparse.Namespace) -> None:
124 def merge(repo: str, ref: str) -> str:
139 def enable(repo: str, check: str) -> str:
145 def disable(repo: str, check: str, drop: bool) -> str:
154 def _split(s: str) -> Dict[str, bool]:
161 if item.startswith("-*"):
164 if item.startswith("-") and "*" in item:
166 if item.startswith("-"):
173 def _join(data: Dict[str, bool]) -> str:
176 ["-*"] + [k if v else f"-{k}" for k, v in sorted(data.items())]
186 ) -> List[Dict[str, str]]:
198 ) -> List[Dict[str, str]]:
210 def _unroll(repo: List[Dict[str, str]]) -> Dict[str, str]:
217 def _roll(data: Dict[str, str]) -> List[Dict[str, str]]:
218 return [{"key": k, "value": v} for k, v in sorted(data.items())]
221 def load_config(path: str) -> Tuple[str, Dict[str, Any]]:
222 if "clang-tidy" not in path:
223 path = os.path.join(path, ".clang-tidy")
229 data = "\n".join([x for x in f.readlines() if not x.startswith("#")])
230 return (path, yaml.safe_load(data))
233 def format_yaml_output(data: Dict[str, Any]) -> str:
235 - filter out excess empty lines
236 - insert new lines between keys
238 yaml_string = yaml.dump(data, sort_keys=False, indent=4)
239 lines: List[str] = []
241 # Strip excess new lines.
245 if len(lines) and re.match("[a-zA-Z0-9]+:", line):
246 lines.append("")
247 lines.append(line)
248 lines.append("")
250 return "\n".join(lines)