Skip to content

Commit b2f8786

Browse files
committed
nix: detect unused python code
Now `postgrest-lint` shows: ``` Linting workflows... Scanning nix files for unused code... Scanning python files for unused code... nix/tools/generate_targets.py:13: unused variable 'JWT_DURATION' (60% confidence) test/io/test_cli.py:6: unused import 'repeat' (90% confidence) ``` Also corrected the above detected files
1 parent dc46aea commit b2f8786

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

nix/tools/generate_targets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
SECRET = b"reallyreallyreallyreallyverysafe"
1212
URL = "http://postgrest"
13-
JWT_DURATION = 120
1413
TOTAL_TARGETS = 50000 # tuned by hand to reduce result variance
1514

1615

nix/tools/style.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
, hlint
88
, hsie
99
, nixpkgs-fmt
10+
, python3Packages
1011
, silver-searcher
1112
, statix
1213
, stylish-haskell
@@ -63,6 +64,10 @@ let
6364
echo "Scanning nix files for unused code..."
6465
${deadnix}/bin/deadnix -f
6566
67+
echo "Scanning python files for unused code..."
68+
${silver-searcher}/bin/ag -l --vimgrep -g '\.l?py$' . \
69+
| xargs ${python3Packages.vulture}/bin/vulture --exclude docs/conf.py
70+
6671
echo "Checking consistency of import aliases in Haskell code..."
6772
${hsie} check-aliases main src
6873

test/io/test_cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import contextlib
44
import dataclasses
55
from datetime import datetime
6-
from itertools import repeat
76
from operator import attrgetter
87
import os
98
import pathlib

0 commit comments

Comments
 (0)