-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-tidy][docs] Add documentation for Clang-Tidy Automation #153166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-clang-tools-extra Author: Harshil Solanki (HARSHIL2836R) ChangesFull diff: https://github.com/llvm/llvm-project/pull/153166.diff 1 Files Affected:
diff --git a/clang-tools-extra/docs/clang-tidy/index.rst b/clang-tools-extra/docs/clang-tidy/index.rst
index b7a366e874130..77f876f2b718d 100644
--- a/clang-tools-extra/docs/clang-tidy/index.rst
+++ b/clang-tools-extra/docs/clang-tidy/index.rst
@@ -41,6 +41,38 @@ parameters file:
$ clang-tidy @parameters_file
+Running Clang-Tidy on Multiple Files
+=====================================
+
+For projects with multiple source files, you can use the :program:`run-clang-tidy.py`
+script to run :program:`clang-tidy` over all files in a compilation database in
+parallel. This script is included with clang-tidy and provides a convenient way
+to analyze entire projects efficiently.
+
+The script requires a compilation database (``compile_commands.json``) which can
+be generated by build systems like CMake (using ``-DCMAKE_EXPORT_COMPILE_COMMANDS=ON``)
+or by tools like Bear.
+
+Example invocations:
+
+.. code-block:: console
+
+ # Run clang-tidy on all files in the compilation database
+ $ run-clang-tidy.py
+
+ # Run with specific checks and apply fixes
+ $ run-clang-tidy.py -fix -checks=-*,readability-*
+
+ # Run on specific files/directories with header filtering
+ $ run-clang-tidy.py src/ -header-filter=src/
+
+ # Run with parallel execution (uses all CPU cores by default)
+ $ run-clang-tidy.py -j 4
+
+The script supports most of the same options as :program:`clang-tidy` itself,
+including ``-checks=``, ``-fix``, ``-header-filter=``, and configuration options.
+Run ``run-clang-tidy.py --help`` for a complete list of available options.
+
:program:`clang-tidy` has its own checks and can also run Clang Static Analyzer
checks. Each check has a name and the checks to run can be chosen using the
``-checks=`` option, which specifies a comma-separated list of positive and
|
|
@llvm/pr-subscribers-clang-tidy Author: Harshil Solanki (HARSHIL2836R) ChangesFull diff: https://github.com/llvm/llvm-project/pull/153166.diff 1 Files Affected:
diff --git a/clang-tools-extra/docs/clang-tidy/index.rst b/clang-tools-extra/docs/clang-tidy/index.rst
index b7a366e874130..77f876f2b718d 100644
--- a/clang-tools-extra/docs/clang-tidy/index.rst
+++ b/clang-tools-extra/docs/clang-tidy/index.rst
@@ -41,6 +41,38 @@ parameters file:
$ clang-tidy @parameters_file
+Running Clang-Tidy on Multiple Files
+=====================================
+
+For projects with multiple source files, you can use the :program:`run-clang-tidy.py`
+script to run :program:`clang-tidy` over all files in a compilation database in
+parallel. This script is included with clang-tidy and provides a convenient way
+to analyze entire projects efficiently.
+
+The script requires a compilation database (``compile_commands.json``) which can
+be generated by build systems like CMake (using ``-DCMAKE_EXPORT_COMPILE_COMMANDS=ON``)
+or by tools like Bear.
+
+Example invocations:
+
+.. code-block:: console
+
+ # Run clang-tidy on all files in the compilation database
+ $ run-clang-tidy.py
+
+ # Run with specific checks and apply fixes
+ $ run-clang-tidy.py -fix -checks=-*,readability-*
+
+ # Run on specific files/directories with header filtering
+ $ run-clang-tidy.py src/ -header-filter=src/
+
+ # Run with parallel execution (uses all CPU cores by default)
+ $ run-clang-tidy.py -j 4
+
+The script supports most of the same options as :program:`clang-tidy` itself,
+including ``-checks=``, ``-fix``, ``-header-filter=``, and configuration options.
+Run ``run-clang-tidy.py --help`` for a complete list of available options.
+
:program:`clang-tidy` has its own checks and can also run Clang Static Analyzer
checks. Each check has a name and the checks to run can be chosen using the
``-checks=`` option, which specifies a comma-separated list of positive and
|
… its limitations and encouraging comprehensive analysis
carlosgalvezp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a minor last comment! Thanks for improving the docs :)
Co-authored-by: Baranov Victor <[email protected]>
Co-authored-by: Baranov Victor <[email protected]>
Co-authored-by: Baranov Victor <[email protected]>
|
How can I build the file and check if it's correct? I used docutils to convert rst to html but there were some errors |
You need to have |
|
You can also look at CI job Test documentation build / Test documentation build (pull_request) that is build for current PR. |
I believe you also need to enable these CMake flags: |
Co-authored-by: Baranov Victor <[email protected]>
vbvictor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@HARSHIL2836R Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/20436 Here is the relevant piece of the build log for the reference |
Resolves #90772