From 5cb1d8e8d8c35b8fd6765d31f65c3a88a7788b87 Mon Sep 17 00:00:00 2001 From: Rob Bailiff Date: Thu, 12 Feb 2026 10:22:50 +0000 Subject: [PATCH 1/6] Added vulture to workflows --- .github/actions/check-dead-code/action.yaml | 18 ++++++++++++++++++ .github/workflows/stage-1-commit.yaml | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/actions/check-dead-code/action.yaml diff --git a/.github/actions/check-dead-code/action.yaml b/.github/actions/check-dead-code/action.yaml new file mode 100644 index 000000000..859e0e86b --- /dev/null +++ b/.github/actions/check-dead-code/action.yaml @@ -0,0 +1,18 @@ +name: "Check Dead Code" +description: "Runs Vulture to detect unused Python code." + +runs: + using: "composite" + steps: + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + + - name: Install dependencies + shell: bash + run: make dependencies install-python + + - name: Run Vulture + shell: bash + run: poetry run vulture . --min-confidence 80 diff --git a/.github/workflows/stage-1-commit.yaml b/.github/workflows/stage-1-commit.yaml index 36a15737d..86c53ed5c 100644 --- a/.github/workflows/stage-1-commit.yaml +++ b/.github/workflows/stage-1-commit.yaml @@ -157,3 +157,13 @@ jobs: uses: actions/checkout@v6 - name: "Run OWASP Dependency Scan" uses: ./.github/actions/owasp-dependency-scan + check-dead-code: + name: "Check for dead code" + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: "Checkout code" + uses: actions/checkout@v6 + - name: "Check for dead code" + uses: ./.github/actions/check-dead-code + From f05a2fc78c0579dbac540c3257934d938226bb4e Mon Sep 17 00:00:00 2001 From: Rob Bailiff Date: Thu, 26 Feb 2026 16:57:04 +0000 Subject: [PATCH 2/6] Added new make commands and added to project --- .github/actions/check-dead-code/action.yaml | 3 ++- Makefile | 7 +++++++ pyproject.toml | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-dead-code/action.yaml b/.github/actions/check-dead-code/action.yaml index 859e0e86b..bd54e55dc 100644 --- a/.github/actions/check-dead-code/action.yaml +++ b/.github/actions/check-dead-code/action.yaml @@ -15,4 +15,5 @@ runs: - name: Run Vulture shell: bash - run: poetry run vulture . --min-confidence 80 + run: poetry run vulture . --min-confidence 80 --exit-non-zero-on-found + diff --git a/Makefile b/Makefile index 4cd4d9fc1..4380e9c35 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,13 @@ format: ## Format and fix code format_lint: format lint +# Vulture +vulture: + poetry run vulture + +vulture-check: + poetry run vulture --exit-non-zero-on-found + #Files to loop over in release _dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests" diff --git a/pyproject.toml b/pyproject.toml index cf9a9c3a4..369bdfe67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ behave = "^1.3.3" python-dotenv = "^1.2.1" openapi-spec-validator = "^0.7.2" pip-licenses = "^5.5.0" +vulture = "^2.14" [tool.poetry-plugin-lambda-build] @@ -115,3 +116,11 @@ exclude_lines = [ "if TYPE_CHECKING:", "raise NotImplementedError", ] + +[tool.vulture] +min_confidence = 80 +paths = ["src/", "tests/"] +#ignore_names = ["*_pb2.py", "migrations/"] +ignore_decorators = ["@app.route", "@click.command"] +#ignore_decorators = ["@app.*", "@pytest.*"] + From c36becfce027943e56bc5cc92db2d40ee735d3fd Mon Sep 17 00:00:00 2001 From: Rob Bailiff Date: Thu, 26 Feb 2026 16:58:44 +0000 Subject: [PATCH 3/6] Added updated lockfile --- poetry.lock | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index ffdf6a0f4..667a1bd1c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -1636,8 +1636,11 @@ files = [ {file = "lxml-5.4.0-cp36-cp36m-win_amd64.whl", hash = "sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121"}, {file = "lxml-5.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872"}, {file = "lxml-5.4.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e"}, + {file = "lxml-5.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0"}, {file = "lxml-5.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92"}, + {file = "lxml-5.4.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e"}, {file = "lxml-5.4.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5"}, + {file = "lxml-5.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188"}, {file = "lxml-5.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6"}, {file = "lxml-5.4.0-cp37-cp37m-win32.whl", hash = "sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063"}, {file = "lxml-5.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49"}, @@ -3396,6 +3399,18 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["backports-zstd (>=1.0.0) ; python_version < \"3.14\""] +[[package]] +name = "vulture" +version = "2.14" +description = "Find dead code" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "vulture-2.14-py2.py3-none-any.whl", hash = "sha256:d9a90dba89607489548a49d557f8bac8112bd25d3cbc8aeef23e860811bd5ed9"}, + {file = "vulture-2.14.tar.gz", hash = "sha256:cb8277902a1138deeab796ec5bef7076a6e0248ca3607a3f3dee0b6d9e9b8415"}, +] + [[package]] name = "wcwidth" version = "0.2.13" @@ -3709,4 +3724,4 @@ propcache = ">=0.2.1" [metadata] lock-version = "2.1" python-versions = "^3.13" -content-hash = "383eb0e3581570630fc52690d61866a180122fe61c891bea564a82f354a99992" +content-hash = "3b23f35fd89adba248abd4fbbd5d0b4d004128aea5f6608c31eca3bef05571fe" From ec8a381809d7d929cbbfe810185c22dd480630f8 Mon Sep 17 00:00:00 2001 From: Rob Bailiff Date: Mon, 2 Mar 2026 13:48:21 +0000 Subject: [PATCH 4/6] Minimal config with no errors --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 369bdfe67..dc248cebc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,7 +120,4 @@ exclude_lines = [ [tool.vulture] min_confidence = 80 paths = ["src/", "tests/"] -#ignore_names = ["*_pb2.py", "migrations/"] -ignore_decorators = ["@app.route", "@click.command"] -#ignore_decorators = ["@app.*", "@pytest.*"] - +ignore_names = ["secretsmanager_client", "consumer_*", "rule_processor_instance"] From 00dfeea075a0f4537cfbfce5b9ca77bd4039fe13 Mon Sep 17 00:00:00 2001 From: Rob Bailiff Date: Mon, 2 Mar 2026 14:02:08 +0000 Subject: [PATCH 5/6] Corrected vulture commands --- .github/actions/check-dead-code/action.yaml | 2 +- Makefile | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/actions/check-dead-code/action.yaml b/.github/actions/check-dead-code/action.yaml index bd54e55dc..0e595052b 100644 --- a/.github/actions/check-dead-code/action.yaml +++ b/.github/actions/check-dead-code/action.yaml @@ -15,5 +15,5 @@ runs: - name: Run Vulture shell: bash - run: poetry run vulture . --min-confidence 80 --exit-non-zero-on-found + run: poetry run vulture diff --git a/Makefile b/Makefile index 4380e9c35..342b5c14b 100644 --- a/Makefile +++ b/Makefile @@ -28,13 +28,9 @@ format: ## Format and fix code format_lint: format lint -# Vulture vulture: poetry run vulture -vulture-check: - poetry run vulture --exit-non-zero-on-found - #Files to loop over in release _dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests" @@ -59,7 +55,7 @@ config:: # Configure development environment (main) @Configuration # TODO: Use only 'make' targets that are specific to this project, e.g. you may not need to install Node.js make _install-dependencies -precommit: test-unit build test-integration lint ## Pre-commit tasks +precommit: test-unit build test-integration lint vulture ## Pre-commit tasks python -m this # ============================================================================== From 7282f9a5df240978d6c52102d28cedbfa15bc80b Mon Sep 17 00:00:00 2001 From: Rob Bailiff Date: Mon, 2 Mar 2026 15:10:20 +0000 Subject: [PATCH 6/6] Generating new lock file --- poetry.lock | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index c59d3c799..bace7d18e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -3170,6 +3170,18 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["backports-zstd (>=1.0.0) ; python_version < \"3.14\""] +[[package]] +name = "vulture" +version = "2.14" +description = "Find dead code" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "vulture-2.14-py2.py3-none-any.whl", hash = "sha256:d9a90dba89607489548a49d557f8bac8112bd25d3cbc8aeef23e860811bd5ed9"}, + {file = "vulture-2.14.tar.gz", hash = "sha256:cb8277902a1138deeab796ec5bef7076a6e0248ca3607a3f3dee0b6d9e9b8415"}, +] + [[package]] name = "wcwidth" version = "0.2.13" @@ -3456,4 +3468,4 @@ propcache = ">=0.2.1" [metadata] lock-version = "2.1" python-versions = "^3.13" -content-hash = "c5064b43e402173391286c84cff772c1776fdf816a8fbd229cfdafa26da4b456" +content-hash = "4456e8d9141a4581c9fc2a1bda3c779fe194359c2d5a1588fe180563afb9b2b6"