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
This commit is contained in:
committed by
Steve Chavez
parent
dc46aea15e
commit
b2f8786821
@@ -10,7 +10,6 @@ import random
|
|||||||
|
|
||||||
SECRET = b"reallyreallyreallyreallyverysafe"
|
SECRET = b"reallyreallyreallyreallyverysafe"
|
||||||
URL = "http://postgrest"
|
URL = "http://postgrest"
|
||||||
JWT_DURATION = 120
|
|
||||||
TOTAL_TARGETS = 50000 # tuned by hand to reduce result variance
|
TOTAL_TARGETS = 50000 # tuned by hand to reduce result variance
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
, hlint
|
, hlint
|
||||||
, hsie
|
, hsie
|
||||||
, nixpkgs-fmt
|
, nixpkgs-fmt
|
||||||
|
, python3Packages
|
||||||
, silver-searcher
|
, silver-searcher
|
||||||
, statix
|
, statix
|
||||||
, stylish-haskell
|
, stylish-haskell
|
||||||
@@ -63,6 +64,10 @@ let
|
|||||||
echo "Scanning nix files for unused code..."
|
echo "Scanning nix files for unused code..."
|
||||||
${deadnix}/bin/deadnix -f
|
${deadnix}/bin/deadnix -f
|
||||||
|
|
||||||
|
echo "Scanning python files for unused code..."
|
||||||
|
${silver-searcher}/bin/ag -l --vimgrep -g '\.l?py$' . \
|
||||||
|
| xargs ${python3Packages.vulture}/bin/vulture --exclude docs/conf.py
|
||||||
|
|
||||||
echo "Checking consistency of import aliases in Haskell code..."
|
echo "Checking consistency of import aliases in Haskell code..."
|
||||||
${hsie} check-aliases main src
|
${hsie} check-aliases main src
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from itertools import repeat
|
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|||||||
Reference in New Issue
Block a user