[clang-tools-extra] [clang-tidy][NFC] Add mention of running 'clang-tidy' on changes in Contributing.rst (PR #148547)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 13 13:40:56 PDT 2025
https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/148547
Follow up to https://github.com/llvm/llvm-project/pull/147793.
Originally suggested in https://github.com/llvm/llvm-project/pull/147793#issuecomment-3059021433
>From 9ee0621a78423ee97d2dcafb6b8de35783222b4e Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Sun, 13 Jul 2025 23:28:34 +0300
Subject: [PATCH 1/3] [clang-tidy][NFC] Add mention of running 'clang-tidy' on
changes before submitting a patch
---
.../docs/clang-tidy/Contributing.rst | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/clang-tools-extra/docs/clang-tidy/Contributing.rst b/clang-tools-extra/docs/clang-tidy/Contributing.rst
index 9611c655886f2..95a01147b369a 100644
--- a/clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ b/clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -657,6 +657,25 @@ directory. The path to this directory is available in a lit test with the varia
.. _FileCheck: https://llvm.org/docs/CommandGuide/FileCheck.html
.. _test/clang-tidy/checkers/google/readability-casting.cpp: https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
+
+Submitting a Pull Request
+-------------------------
+
+Before submitting a pull request, contributors are encouraged to run
+:program:`clang-tidy` and :program:`clang-format` on their changes to ensure
+code quality and catch potential issues. While :program:`clang-tidy` is not
+currently enforced in CI, following this practice helps maintain code
+consistency and prevent common errors.
+
+Here's useful command to check your staged changes:
+
+.. code-block:: console
+
+ $ git diff --staged -U0 | ./clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py \
+ -j $(nproc) -path build/ -p1 -only-check-in-db
+ $ git clang-format
+
+
Out-of-tree check plugins
-------------------------
>From 272e1acfc11ebe0bbc2adf5a84bc8413fc85335c Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Sun, 13 Jul 2025 23:36:49 +0300
Subject: [PATCH 2/3] add mention about potential false positives
---
clang-tools-extra/docs/clang-tidy/Contributing.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang-tools-extra/docs/clang-tidy/Contributing.rst b/clang-tools-extra/docs/clang-tidy/Contributing.rst
index 95a01147b369a..fd1e6ec41c383 100644
--- a/clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ b/clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -675,6 +675,9 @@ Here's useful command to check your staged changes:
-j $(nproc) -path build/ -p1 -only-check-in-db
$ git clang-format
+Note that some warnings may be false positives or require careful consideration
+before fixing. Use your judgment and feel free to discuss in the pull request
+if you're unsure about a particular warning.
Out-of-tree check plugins
-------------------------
>From fc4e15782b5a0373d1825d9bc07945853fb59e00 Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Sun, 13 Jul 2025 23:37:53 +0300
Subject: [PATCH 3/3] add newline
---
clang-tools-extra/docs/clang-tidy/Contributing.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/clang-tools-extra/docs/clang-tidy/Contributing.rst b/clang-tools-extra/docs/clang-tidy/Contributing.rst
index fd1e6ec41c383..66c0abadc6a40 100644
--- a/clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ b/clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -679,6 +679,7 @@ Note that some warnings may be false positives or require careful consideration
before fixing. Use your judgment and feel free to discuss in the pull request
if you're unsure about a particular warning.
+
Out-of-tree check plugins
-------------------------
More information about the cfe-commits
mailing list