[llvm] 763fbee - [CI][lldb] Add a github workflow that runs pylint on LLDB API test changes (#182003)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 11:07:30 PST 2026


Author: Michael Buch
Date: 2026-02-20T19:07:25Z
New Revision: 763fbee264fe85182c4aefdc37c3a299c4dbcf98

URL: https://github.com/llvm/llvm-project/commit/763fbee264fe85182c4aefdc37c3a299c4dbcf98
DIFF: https://github.com/llvm/llvm-project/commit/763fbee264fe85182c4aefdc37c3a299c4dbcf98.diff

LOG: [CI][lldb] Add a github workflow that runs pylint on LLDB API test changes (#182003)

The motivator here is that Python allows class methods to be redefined.
But in the vast majority of cases this is a bug. E.g., in our API
test-suite two methods with the same name cause the latest definition to
shadow the earlier, in which case only one test-case runs. This happens
silently. Every couple of months i've been running the script from
https://github.com/llvm/llvm-project/pull/97043 manually on the
code-base and it catches a handful of these every time.

This patch sets up a github action that runs on pull requests that
change any files under `lldb/test/API`. The action runs `pylint` on the
changed Python files. The caveat here is that `pylint` isn't set up to
run cleanly on our test-suite. So I just use the [specific redefinition
error
code](https://pylint.readthedocs.io/en/stable/user_guide/messages/error/function-redefined.html).
Any other errors won't cause `pylint` to fail for now (hence the
`--error-under=0`).

Here's an example:
<img width="1412" height="367" alt="Screenshot From 2026-02-20 10-29-28"
src="https://github.com/user-attachments/assets/20093be8-a122-4e17-944a-4472eb12ab25"
/>

Added: 
    .github/workflows/lldb-pylint-action.yml
    llvm/utils/git/requirements_pylint.txt
    llvm/utils/git/requirements_pylint.txt.in

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/.github/workflows/lldb-pylint-action.yml b/.github/workflows/lldb-pylint-action.yml
new file mode 100644
index 0000000000000..08503dc511d97
--- /dev/null
+++ b/.github/workflows/lldb-pylint-action.yml
@@ -0,0 +1,60 @@
+name: "LLDB Python Lint"
+
+permissions:
+  contents: read
+
+on:
+  pull_request:
+    paths:
+      - 'lldb/test/API/**.py'
+      - '.github/workflows/lldb-pylint-action.yml'
+
+jobs:
+  code_linter:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-24.04
+    timeout-minutes: 60
+    concurrency:
+      group: ${{ github.workflow }}-${{ github.ref }}
+      cancel-in-progress: true
+    steps:
+      - name: Fetch LLVM sources
+        uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+        with:
+          fetch-depth: 2
+
+      - name: Setup python
+        uses: actions/setup-python at 83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
+        with:
+          python-version: '3.14'
+
+      - name: Install dependencies
+        run: |
+          python3 -m pip install --require-hashes -r ./llvm/utils/git/requirements_pylint.txt
+      
+      - name: Get changed files
+        id: changed-files
+        uses: tj-actions/changed-files at e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
+        with:
+          separator: " "
+          skip_initial_fetch: true
+          base_sha: 'HEAD~1'
+          sha: 'HEAD'
+          files: |
+            **/*.py
+      
+      - name: List files
+        env:
+          CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
+        run: |
+          echo "Changed files:"
+          echo "$CHANGED_FILES"
+
+      - name: Run Python test-name linter
+        env:
+          CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
+        # Only run pylint if we have any changed files at this point.
+        # Otherwise pylint errors out.
+        if: ${{ env.CHANGED_FILES != '' }}
+        run: |
+          pylint --disable=all --enable=E0102 $CHANGED_FILES

diff  --git a/llvm/utils/git/requirements_pylint.txt b/llvm/utils/git/requirements_pylint.txt
new file mode 100644
index 0000000000000..6bd3bbb116dd8
--- /dev/null
+++ b/llvm/utils/git/requirements_pylint.txt
@@ -0,0 +1,34 @@
+#
+# This file is autogenerated by pip-compile with Python 3.14
+# by the following command:
+#
+#    pip-compile --generate-hashes --output-file=requirements_pylint.txt requirements_pylint.txt.in
+#
+astroid==4.0.4 \
+    --hash=sha256:52f39653876c7dec3e3afd4c2696920e05c83832b9737afc21928f2d2eb7a753 \
+    --hash=sha256:986fed8bcf79fb82c78b18a53352a0b287a73817d6dbcfba3162da36667c49a0
+    # via pylint
+dill==0.4.1 \
+    --hash=sha256:1e1ce33e978ae97fcfcff5638477032b801c46c7c65cf717f95fbc2248f79a9d \
+    --hash=sha256:423092df4182177d4d8ba8290c8a5b640c66ab35ec7da59ccfa00f6fa3eea5fa
+    # via pylint
+isort==7.0.0 \
+    --hash=sha256:1bcabac8bc3c36c7fb7b98a76c8abb18e0f841a3ba81decac7691008592499c1 \
+    --hash=sha256:5513527951aadb3ac4292a41a16cbc50dd1642432f5e8c20057d414bdafb4187
+    # via pylint
+mccabe==0.7.0 \
+    --hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \
+    --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e
+    # via pylint
+platformdirs==4.9.2 \
+    --hash=sha256:9170634f126f8efdae22fb58ae8a0eaa86f38365bc57897a6c4f781d1f5875bd \
+    --hash=sha256:9a33809944b9db043ad67ca0db94b14bf452cc6aeaac46a88ea55b26e2e9d291
+    # via pylint
+pylint==4.0.4 \
+    --hash=sha256:63e06a37d5922555ee2c20963eb42559918c20bd2b21244e4ef426e7c43b92e0 \
+    --hash=sha256:d9b71674e19b1c36d79265b5887bf8e55278cbe236c9e95d22dc82cf044fdbd2
+    # via -r requirements_pylint.txt.in
+tomlkit==0.14.0 \
+    --hash=sha256:592064ed85b40fa213469f81ac584f67a4f2992509a7c3ea2d632208623a3680 \
+    --hash=sha256:cf00efca415dbd57575befb1f6634c4f42d2d87dbba376128adb42c121b87064
+    # via pylint

diff  --git a/llvm/utils/git/requirements_pylint.txt.in b/llvm/utils/git/requirements_pylint.txt.in
new file mode 100644
index 0000000000000..8e121a6f7f855
--- /dev/null
+++ b/llvm/utils/git/requirements_pylint.txt.in
@@ -0,0 +1 @@
+pylint==4.0.4


        


More information about the llvm-commits mailing list