-{ pkgs ? import <nixpkgs> { } }:
+{ pkgs ? import <nixpkgs> { }, lint ? false }:
pkgs.python3Packages.callPackage
({ lib, buildPythonPackage, nix, git, autopep8, mypy, pylint, }:
buildPythonPackage rec {
pname = "pinch";
version = "1.3";
src = lib.cleanSource ./.;
- checkInputs = [ nix git autopep8 mypy pylint ];
+ checkInputs = [ nix git mypy ] ++ lib.optionals lint [ autopep8 pylint ];
doCheck = true;
checkPhase = "./test.sh";
}) { }
find . -name '*_test.py' -print0 | xargs -0 -r -n1 python3
-find . -name '*.py' -print0 | xargs -0 pylint --reports=n --persistent=n --ignore-imports=y -d fixme,invalid-name,missing-docstring,subprocess-run-check,too-few-public-methods
-
-formatting_needs_fixing=$(
- find . -name '*.py' -print0 |
- xargs -P "$PARALLELISM" -0 -n1 autopep8 --diff -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-)
-if [[ "$formatting_needs_fixing" ]];then
- echo "Formatting needs fixing:"
- echo "$formatting_needs_fixing"
- exit 1
+if [ "$1" = lint ];then
+
+ find . -name '*.py' -print0 | xargs -0 pylint --reports=n --persistent=n --ignore-imports=y -d fixme,invalid-name,missing-docstring,subprocess-run-check,too-few-public-methods
+
+ formatting_needs_fixing=$(
+ find . -name '*.py' -print0 |
+ xargs -P "$PARALLELISM" -0 -n1 autopep8 --diff -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ )
+ if [[ "$formatting_needs_fixing" ]];then
+ echo "Formatting needs fixing:"
+ echo "$formatting_needs_fixing"
+ exit 1
+ fi
+
fi