Skip to content

Commit

Permalink
ci: add dead code detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas1312 committed Oct 10, 2023
1 parent a64be1a commit 01797fd
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,40 +170,15 @@ jobs:
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Log dead code
run: vulture src/kili tests

- name: Log dead code
run: dead

- name: Log dead code
run: |
{ vulture src/kili tests ; dead ; }
- name: Find dead code with vulture
run: vulture src/kili tests > dead_code.log

- name: Log dead code
run: |
{ vulture src/kili tests ; dead ; } > dead_code.log
- name: Log dead code
run: >-
{ vulture src/kili tests ; dead ; } |
grep -e "src/kili" |
grep -v
-e "is only referenced in tests"
-e "_ is never read"
-e "internal.py"
-e "unused attribute 'internal'"
-e "affected_rows"
-e "src/kili/orm"
-e "src/kili/types.py"
-e "src/kili/services"
-e "src/kili/entrypoints"
-e "src/kili/core/graphql/ws_graphql_client"
> dead_code.log
- name: Find dead code with dead
run: dead >> dead_code.log

- name: Log dead code
run: >-
{ vulture src/kili tests ; dead ; } |
cat dead_code.log |
grep -e "src/kili" |
grep -v
-e "is only referenced in tests"
Expand All @@ -216,11 +191,11 @@ jobs:
-e "src/kili/services"
-e "src/kili/entrypoints"
-e "src/kili/core/graphql/ws_graphql_client"
> dead_code.log
> dead_code_filtered.log
- name: Crash if dead code found
run: |
if [ $(cat dead_code.log | wc -l) -gt 0 ]; then
if [ $(cat dead_code_filtered.log | wc -l) -gt 0 ]; then
cat dead_code.log
echo "\nDead code found"
exit 1
Expand Down

0 comments on commit 01797fd

Please sign in to comment.