Author: Chris Cotter Date: 2023-01-05T15:28:57Z New Revision: 210b731c01b020693aa8f53231c659ff5f60149e
URL: https://github.com/llvm/llvm-project/commit/210b731c01b020693aa8f53231c659ff5f60149e DIFF: https://github.com/llvm/llvm-project/commit/210b731c01b020693aa8f53231c659ff5f60149e.diff LOG: [clang-tidy] Fix minor bug in add_new_check.py While rebuilding the list of checks in add_new_check.py, check is a file is a subdirectory before traversing it. Test plan: Ran `./add_new_check.py --update-docs` and confirmed the list.rst file was unchanged. Reviewed By: carlosgalvezp Differential Revision: https://reviews.llvm.org/D140772 Added: Modified: clang-tools-extra/clang-tidy/add_new_check.py clang-tools-extra/docs/ReleaseNotes.rst Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py index a85767acdce91..e3ad7a286a444 100755 --- a/clang-tools-extra/clang-tidy/add_new_check.py +++ b/clang-tools-extra/clang-tidy/add_new_check.py @@ -322,8 +322,7 @@ def update_checks_list(clang_tidy_path): lines = f.readlines() # Get all existing docs doc_files = [] - for subdir in list(filter(lambda s: not s.endswith('.rst') and not s.endswith('.py'), - os.listdir(docs_dir))): + for subdir in filter(lambda s: os.path.isdir(os.path.join(docs_dir, s)), os.listdir(docs_dir)): for file in filter(lambda s: s.endswith('.rst'), os.listdir(os.path.join(docs_dir, subdir))): doc_files.append([subdir, file]) doc_files.sort() diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 989f4b52d4ac8..0f060f7f5fc7b 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -99,6 +99,9 @@ Improvements to clang-tidy - Change to Python 3 in the shebang of `add_new_check.py` and `rename_check.py`, as the existing code is not compatible with Python 2. +- Fix a minor bug in `add_new_check.py` to only traverse subdirectories + when updating the list of checks in the documentation. + New checks ^^^^^^^^^^ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits