BlueBrain / hpc-coding-conventions

Apache License 2.0
8 stars 5 forks source link

Simplify the clang-tidy configuration file merger #125

Closed tristan0x closed 1 year ago

tristan0x commented 2 years ago

I can't quite figure it out entirely, but this looks like both branches do the same thing:

If so, the lines of code could be reduced by introducing:

name_without_prefix = new_check[1:] if new_check.startswith("-") else new_check
name_with_prefix = "-" + name_with_prefix

and then use

 orig_checks = list(
      check for check in orig_checks if not fnmatch(check, name_with_prefix)
)
# remove check when check=-google-runtime-references to_=-google-* (simplification)
orig_checks = list(
      check for check in orig_checks if not fnmatch(check, name_without_prefix)
)

_Originally posted by @1uc in https://github.com/BlueBrain/hpc-coding-conventions/pull/123#discussion_r865619598_