[clang-tools-extra] [llvm] [TEST][WIP] Run clang-tidy inside ci-container (PR #160193)

Baranov Victor via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 10:44:48 PDT 2025


https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/160193

>From 20b0881907255c0cb04e7499143a6867ec386302 Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Mon, 20 Oct 2025 20:34:36 +0300
Subject: [PATCH 1/2] add clang-tidy violations

---
 clang-tools-extra/clang-tidy/ClangTidy.cpp   | 2 +-
 clang-tools-extra/clangd/tool/ClangdMain.cpp | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 7e18f3806a143..7b8af3b9558e4 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -55,7 +55,7 @@ namespace clang::tidy {
 
 #if CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
 namespace custom {
-void (*RegisterCustomChecks)(const ClangTidyOptions &O,
+void (*RegisterCustomChecks)(const ClangTidyOptions &o,
                              ClangTidyCheckFactories &Factories) = nullptr;
 } // namespace custom
 #endif
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 4a990f8f716ca..50af97cfde6c2 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -995,11 +995,11 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
   Opts.PreambleParseForwardingFunctions = PreambleParseForwardingFunctions;
   Opts.ImportInsertions = ImportInsertions;
   Opts.QueryDriverGlobs = std::move(QueryDriverGlobs);
-  Opts.TweakFilter = [&](const Tweak &T) {
-    if (T.hidden() && !HiddenFeatures)
+  Opts.TweakFilter = [&](const Tweak &t) {
+    if (t.hidden() && !HiddenFeatures)
       return false;
     if (TweakList.getNumOccurrences())
-      return llvm::is_contained(TweakList, T.id());
+      return llvm::is_contained(TweakList, t.id());
     return true;
   };
   if (ForceOffsetEncoding != OffsetEncoding::UnsupportedEncoding)

>From 732b4ca28f81a31a9504b0e25d4676fac35870a8 Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Mon, 20 Oct 2025 20:44:24 +0300
Subject: [PATCH 2/2] test linter

---
 .github/workflows/pr-code-lint.yml | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/pr-code-lint.yml b/.github/workflows/pr-code-lint.yml
index 776ec4af9d2dc..e67b518149c2c 100644
--- a/.github/workflows/pr-code-lint.yml
+++ b/.github/workflows/pr-code-lint.yml
@@ -20,7 +20,7 @@ jobs:
       run:
         shell: bash
     container:
-      image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
+      image: 'ghcr.io/llvm/ci-ubuntu-24.04-lint'
     timeout-minutes: 60
     concurrency:
       group: ${{ github.workflow }}-${{ github.ref }}
@@ -31,6 +31,11 @@ jobs:
         with:
           fetch-depth: 2
       
+      # FIXME: same as in ".github/workflows/pr-code-format.yml"
+      - name: Set Safe Directory
+        run: |
+          chown -R root $(pwd)
+      
       - name: Get changed files
         id: changed-files
         uses: tj-actions/changed-files at ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
@@ -46,22 +51,6 @@ jobs:
         run: |
           echo "Changed files:"
           echo "$CHANGED_FILES"
-
-      # The clang tidy version should always be upgraded to the first version
-      # of a release cycle (x.1.0) or the last version of a release cycle, or
-      # if there have been relevant clang-format backports.
-      - name: Install clang-tidy
-        uses: aminya/setup-cpp at a276e6e3d1db9160db5edc458e99a30d3b109949 # v1.7.1
-        with:
-          clang-tidy: 21.1.0
-      
-      - name: Setup Python env
-        uses: actions/setup-python at a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
-        with:
-          python-version: '3.13'
-
-      - name: Install Python dependencies
-        run: python3 -m pip install -r llvm/utils/git/requirements_linting.txt
       
       # TODO: create special mapping for 'codegen' targets, for now build predefined set
       # TODO: add entrypoint in 'compute_projects.py' that only adds a project and its direct dependencies



More information about the llvm-commits mailing list