diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-06-12 11:42:47 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-06-13 12:19:02 +0200 |
commit | d46051807e37bd1e28a4c6ecd60d3a9f92103cc7 (patch) | |
tree | 9ddc088cd29e866f1d70384dd95066aba60820a3 /lint/summary.py | |
parent | 551a068668cd08ae5025aa05eacd6eb934ca9c4b (diff) | |
download | justbuild-d46051807e37bd1e28a4c6ecd60d3a9f92103cc7.tar.gz |
Add a lint target for clang-tidy
... using the already-committed configuration file and the
version of clang-tidy that was imported from the toolchain.
Diffstat (limited to 'lint/summary.py')
-rwxr-xr-x | lint/summary.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lint/summary.py b/lint/summary.py new file mode 100755 index 00000000..ca7445db --- /dev/null +++ b/lint/summary.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +# Copyright 2025 Huawei Cloud Computing Technology Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +import sys + +FAILED = {} + +for lint in sorted(os.listdir()): + if os.path.isdir(lint): + with open(os.path.join(lint, "result")) as f: + result = f.read().strip() + if result != "PASS": + record = {} + with open(os.path.join(lint, "out/config.json")) as f: + record["config"] = json.load(f) + with open(os.path.join(lint, "stdout")) as f: + log = f.read() + with open(os.path.join(lint, "stderr")) as f: + log += f.read() + record["log"] = log + FAILED[lint] = record + +with open(os.path.join(os.environ.get("OUT"), "failures.json"), "w") as f: + json.dump(FAILED, f) + +failures = list(FAILED.keys()) + +for f in failures: + src = FAILED[f]["config"]["src"] + log = FAILED[f]["log"] + + print("%s %s" % (f, src)) + print("".join([" " + line + "\n" for line in log.splitlines()])) + +if failures: + sys.exit(1) |