Skip to content

Commit 3d4be46

Browse files
committed
adding more guards for the local run of codecheck
1 parent f100869 commit 3d4be46

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/maketools/codecheck

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,33 @@ fi
5858

5959
if [[ $do_modified = false ]]; then
6060
extra[${#extra[@]}]="${basedir}/configure.ac"
61-
extra[${#extra[@]}]="${basedir}/python/plumed.pyx"
6261
fi
6362
if [[ $do_modified = false ]] && [[ $do_local == false ]]; then
63+
#plumedcheck will call "cython" this check may give some problems if you use pyenv
64+
if which cython &> /dev/null; then
65+
extra[${#extra[@]}]="${basedir}/python/plumed.pyx"
66+
fi
6467
extra[${#extra[@]}]=--global-check
6568
fi
6669
# shellcheck disable=SC2086
6770
"${basedir}/src/maketools/plumedcheck" \
6871
--astyle="${basedir}/astyle/astyle" \
6972
--astyle-options="${basedir}/.astyle.options" \
7073
"${extra[@]}" $files
74+
if [[ $do_modified = false ]] && [[ $do_local == false ]]; then
7175
(
7276
# Addig an extra format check for python files.
7377
# The settings are in the ruff.toml in the home directory
7478
# ruff format outputs a list of "would reformat file" followed by a recap
7579
# "head" discards the recap and awk reformat the error message
7680
cd "${basedir}"
81+
#this uses the same check in the base Makefile
7782
if which ruff &> /dev/null; then
78-
python -m ruff format --check \
83+
ruff format --check \
7984
| grep 'Would reformat' \
8085
| awk '{ printf "[%s:0] (error) :ruff_format: python ruff formatting non satisfied\n", $3 }' \
8186
>&2
82-
python -m ruff check --output-format concise \
87+
ruff check --output-format concise \
8388
| head -n -2 \
8489
| awk '{ printf "[%s] (error) :ruff_check: %s", substr($1,1,length($1)-1), $2;
8590
$1=$2="";
@@ -93,6 +98,7 @@ fi
9398
fi
9499

95100
)
101+
fi
96102
fi
97103

98104
if [ $do_cppcheck == true ]; then

0 commit comments

Comments
 (0)