flake8_errs is the variable initialized to empty string ('').
Trying to concat the output of the command
flake8 --config=$(CI_DIR)/lint-configs/python/.flake8 $$py_file;
on each .py file to flake8_errs variable.
Then check if flake8_errs has some content and raise an err.
This is what I tried so far:
flake8_errs =''
.PHONY: .flake8
.flake8:
. $(VIRTUALENV_DIR)/bin/activate; \
if [ "$${FORCE_CHECK_ALL_FILES}" = "true" ]; then \
find ./* -name "*.py" | while read py_file; do \
flake8_errs += flake8 --config=$(CI_DIR)/lint-configs/python/.flake8 $$py_file; \
done; \
else \
echo "No files have changed, skipping run..."; \
fi;
if [ ! -z "${flake8_errs}" ]; then \
exit 1; \
fi;