Currently I iterate through every .py
file in /
directory. For each iteration, I call pycodestyle
and exit as soon as I see the error.
But I want to see all the error messages for every file even if any of file had an error before << This helps developer to see which lines he/she should change in order to pass the test (linting).
If no file prints an error, don't print error. << This will be useful for my Jenkins pipeline.
for file in $(find /-type d -name test -prune -o -type f -name '*.py' -print); do filename=$(basename $file) if [[ $filename != "__init__.py" ]] ; then echo "$file" pycodestyle "${file}" || exit 1 <<< This causes an error. << If it passes the linting, it doesn't exit. fi done
My solution:
Somehow I need a boolean local variable to show whether it prints error. At the end I can check the variable and returns exit or not. But I don't know how to implement this... Thanks!