Skip to content

Commit d988fd5

Browse files
authored
Added vulture to workflows (#585)
* Added vulture to workflows * Added new make commands and added to project * Added updated lockfile * Minimal config with no errors * Corrected vulture commands * Generating new lock file
1 parent ed28613 commit d988fd5

5 files changed

Lines changed: 54 additions & 3 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Check Dead Code"
2+
description: "Runs Vulture to detect unused Python code."
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Set up Python
8+
uses: actions/setup-python@v6
9+
with:
10+
python-version: "3.13"
11+
12+
- name: Install dependencies
13+
shell: bash
14+
run: make dependencies install-python
15+
16+
- name: Run Vulture
17+
shell: bash
18+
run: poetry run vulture
19+

.github/workflows/stage-1-commit.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,13 @@ jobs:
157157
uses: actions/checkout@v6
158158
- name: "Run OWASP Dependency Scan"
159159
uses: ./.github/actions/owasp-dependency-scan
160+
check-dead-code:
161+
name: "Check for dead code"
162+
runs-on: ubuntu-latest
163+
timeout-minutes: 2
164+
steps:
165+
- name: "Checkout code"
166+
uses: actions/checkout@v6
167+
- name: "Check for dead code"
168+
uses: ./.github/actions/check-dead-code
169+

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ format: ## Format and fix code
2828

2929
format_lint: format lint
3030

31+
vulture:
32+
poetry run vulture
33+
3134
#Files to loop over in release
3235
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
3336

@@ -52,7 +55,7 @@ config:: # Configure development environment (main) @Configuration
5255
# TODO: Use only 'make' targets that are specific to this project, e.g. you may not need to install Node.js
5356
make _install-dependencies
5457

55-
precommit: test-unit build test-integration lint ## Pre-commit tasks
58+
precommit: test-unit build test-integration lint vulture ## Pre-commit tasks
5659
python -m this
5760

5861
# ==============================================================================

poetry.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ python-dotenv = "^1.2.1"
6363
openapi-spec-validator = "^0.7.2"
6464
pip-licenses = "^5.5.0"
6565
cachetools = "^7.0.1"
66+
vulture = "^2.14"
67+
6668

6769
[tool.poetry-plugin-lambda-build]
6870
docker-image = "public.ecr.aws/sam/build-python3.13:1.139-x86_64" # See https://gallery.ecr.aws/search?searchTerm=%22python%22&architecture=x86-64&popularRegistries=amazon&verified=verified&operatingSystems=Linux
@@ -114,3 +116,8 @@ exclude_lines = [
114116
"if TYPE_CHECKING:",
115117
"raise NotImplementedError",
116118
]
119+
120+
[tool.vulture]
121+
min_confidence = 80
122+
paths = ["src/", "tests/"]
123+
ignore_names = ["secretsmanager_client", "consumer_*", "rule_processor_instance"]

0 commit comments

Comments
 (0)