scripts/clang-tools: Convert clang-tidy args to list

Convert list of clang-tidy arguments to a list for ease of adding to
them and extending them as required.

Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Guru Das Srinagesh 2022-10-11 12:06:00 -07:00 committed by Masahiro Yamada
parent 11df33c36c
commit 04518e4c2e
1 changed files with 6 additions and 5 deletions

View File

@ -45,13 +45,14 @@ def init(l, a):
def run_analysis(entry):
# Disable all checks, then re-enable the ones we want
checks = "-checks=-*,"
checks = []
checks.append("-checks=-*")
if args.type == "clang-tidy":
checks += "linuxkernel-*"
checks.append("linuxkernel-*")
else:
checks += "clang-analyzer-*"
checks += ",-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling"
p = subprocess.run(["clang-tidy", "-p", args.path, checks, entry["file"]],
checks.append("clang-analyzer-*")
checks.append("-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling")
p = subprocess.run(["clang-tidy", "-p", args.path, ",".join(checks), entry["file"]],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=entry["directory"])