CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
2.7 KiB
Python
94 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# ===-----------------------------------------------------------------------===#
|
|
#
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
#
|
|
# ===-----------------------------------------------------------------------===#
|
|
|
|
"""
|
|
|
|
Clang-Tidy Check List Checker
|
|
=============================
|
|
|
|
This wrapper script runs `add_new_check.py --update-docs` on
|
|
a temporary copy of clang-tools-extra/{clang-tidy,docs} and
|
|
writes the generated docs/clang-tidy/checks/list.rst to the
|
|
requested output path.
|
|
"""
|
|
|
|
import argparse
|
|
import io
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
from typing import Final, Sequence
|
|
|
|
|
|
EXTRA_DIR: Final = os.path.join(os.path.dirname(__file__), "../..")
|
|
CLANG_TIDY_DIR: Final = os.path.join(EXTRA_DIR, "clang-tidy")
|
|
DOCS_DIR: Final = os.path.join(EXTRA_DIR, "docs")
|
|
LIST_DOC: Final = os.path.join(DOCS_DIR, "clang-tidy", "checks", "list.rst")
|
|
|
|
|
|
def read_text(path: str) -> str:
|
|
with io.open(path, "r", encoding="utf-8") as f:
|
|
return f.read()
|
|
|
|
|
|
def write_text(path: str, content: str) -> None:
|
|
with io.open(path, "w", encoding="utf-8", newline="") as f:
|
|
f.write(content)
|
|
|
|
|
|
def generate_updated_list() -> str:
|
|
with tempfile.TemporaryDirectory() as td:
|
|
temp_root = os.path.join(td, "clang-tools-extra")
|
|
temp_clang_tidy_dir = os.path.join(temp_root, "clang-tidy")
|
|
temp_docs_dir = os.path.join(temp_root, "docs")
|
|
|
|
shutil.copytree(CLANG_TIDY_DIR, temp_clang_tidy_dir)
|
|
shutil.copytree(DOCS_DIR, temp_docs_dir)
|
|
|
|
subprocess.run(
|
|
[
|
|
sys.executable,
|
|
os.path.join(temp_clang_tidy_dir, "add_new_check.py"),
|
|
"--update-docs",
|
|
],
|
|
cwd=temp_clang_tidy_dir,
|
|
check=True,
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT,
|
|
text=True,
|
|
)
|
|
|
|
return read_text(
|
|
os.path.join(temp_docs_dir, "clang-tidy", "checks", "list.rst")
|
|
)
|
|
|
|
|
|
def main(argv: Sequence[str]) -> int:
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("-o", "--output", dest="out", required=True)
|
|
args = ap.parse_args(argv)
|
|
|
|
generated = generate_updated_list()
|
|
write_text(args.out, generated)
|
|
|
|
if read_text(LIST_DOC) != generated:
|
|
sys.stderr.write(
|
|
"\n'clang-tools-extra/docs/clang-tidy/checks/list.rst' is out of date.\n"
|
|
"Fix it by running 'clang-tools-extra/clang-tidy/add_new_check.py --update-docs'.\n\n"
|
|
)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main(sys.argv[1:]))
|