From: Christian Heller Date: Mon, 17 Mar 2025 08:36:20 +0000 (+0100) Subject: Re-write linting script and its dependencies to use lintplom. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/conditions?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=taskplom Re-write linting script and its dependencies to use lintplom. --- diff --git a/.mypy.ini b/.mypy.ini deleted file mode 100644 index e4f7658..0000000 --- a/.mypy.ini +++ /dev/null @@ -1,2 +0,0 @@ -[mypy] -mypy_path = $MYPY_CONFIG_FILE_DIR/src diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 45bc14d..0000000 --- a/.pylintrc +++ /dev/null @@ -1,3 +0,0 @@ -[BASIC] -init-hook='import sys; sys.path[0:0] = ["src"]' -good-names-rgxs=(.*_)?(GET|POST)(_.+)?,,test_[A-Z]+ diff --git a/scripts/pre-commit b/scripts/pre-commit index 3707445..a8c4fd4 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -1,12 +1,20 @@ #!/bin/sh +set -e + +echo "===[ Running linters on source directories. ]===" DIRS='src src/taskplom tests' -TOOLS='flake8 pylint mypy' -for dir in $DIRS; do - for tool in $TOOLS; do - echo "Running ${tool} on ${dir}/ …." - python3 -m ${tool} ${dir}/*.py - done +DIRS=tests +for DIR in $DIRS; do + lintplom "${DIR}" done -echo "Running unittest-parallel on tests/." -set -e + +echo "\n\n===[ Running unittest-parallel on tests/. ]===" +DIR_VENV=/tmp/taskplom_venv_unittest_parallel +if [ ! -d "${DIR_VENV}" ]; then + mkdir "${DIR_VENV}" + python3 -m venv "${DIR_VENV}" +fi +. "${DIR_VENV}/bin/activate" +pip3 install unittest-parallel +pip3 install -r tests/requirements.txt unittest-parallel -t . -s tests/ -p '*.py' diff --git a/src/.pylintrc b/src/.pylintrc new file mode 100644 index 0000000..86d4879 --- /dev/null +++ b/src/.pylintrc @@ -0,0 +1,2 @@ +[BASIC] +good-names-rgxs=(.*_)?(GET|POST)(_.+)? diff --git a/tests/.mypy.ini b/tests/.mypy.ini new file mode 100644 index 0000000..bf0df38 --- /dev/null +++ b/tests/.mypy.ini @@ -0,0 +1,2 @@ +[mypy] +mypy_path = $MYPY_CONFIG_FILE_DIR/../src diff --git a/tests/.pylintrc b/tests/.pylintrc new file mode 100644 index 0000000..c18ad05 --- /dev/null +++ b/tests/.pylintrc @@ -0,0 +1,3 @@ +[BASIC] +init-hook='import sys; sys.path[0:0] = ["../src"]' +good-names-rgxs=(.*_)?(GET|POST)(_.+)?,test_[A-Z]+ diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 120000 index 0000000..86715e6 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1 @@ +../src/requirements.txt \ No newline at end of file