Merge remote-tracking branch 'origin/main' into feature/permissions_for_tasks
This commit is contained in:
commit
056bb5cb74
31
bin/run_pyl
31
bin/run_pyl
|
@ -12,8 +12,27 @@ python_projects=(
|
||||||
spiffworkflow-backend
|
spiffworkflow-backend
|
||||||
)
|
)
|
||||||
|
|
||||||
function run_fix_docstrings() {
|
function get_python_dirs() {
|
||||||
fix_python_docstrings $(get_top_level_directories_containing_python_files)
|
(git ls-tree -r HEAD --name-only | grep -E '\.py$' | awk -F '/' '{print $1}' | sort | uniq | grep -v '\.' | grep -Ev '^(bin|migrations)$') || echo ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_autoflake() {
|
||||||
|
if ! command -v autoflake8 >/dev/null ; then
|
||||||
|
pip install autoflake8
|
||||||
|
asdf reshim python
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v autopep8 >/dev/null ; then
|
||||||
|
pip install autopep8
|
||||||
|
asdf reshim python
|
||||||
|
fi
|
||||||
|
|
||||||
|
python_dirs=$(get_python_dirs)
|
||||||
|
python_files=$(find $python_dirs -type f -name "*.py" ! -name '.null-ls*' ! -name '_null-ls*')
|
||||||
|
|
||||||
|
autoflake8 --in-place --remove-unused-variables --remove-duplicate-keys --expand-star-imports --exit-zero-even-if-changed $python_files
|
||||||
|
autoflake --in-place --remove-all-unused-imports $python_files
|
||||||
|
autopep8 --in-place $python_files
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_pre_commmit() {
|
function run_pre_commmit() {
|
||||||
|
@ -22,15 +41,15 @@ function run_pre_commmit() {
|
||||||
|
|
||||||
for python_project in "${python_projects[@]}" ; do
|
for python_project in "${python_projects[@]}" ; do
|
||||||
pushd "$python_project"
|
pushd "$python_project"
|
||||||
run_fix_docstrings || run_fix_docstrings
|
run_autoflake || run_autoflake
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
run_pre_commmit || run_pre_commmit
|
run_pre_commmit || run_pre_commmit
|
||||||
|
|
||||||
for python_project in "${python_projects[@]}"; do
|
for python_project in "${python_projects[@]}"; do
|
||||||
pushd "$python_project"
|
pushd "$python_project"
|
||||||
poet i
|
poetry install
|
||||||
poet mypy
|
poetry run mypy $(get_python_dirs)
|
||||||
poet test
|
poetry run coverage run --parallel -m pytest
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue