Skip to content

Commit

Permalink
scripts/run-flake8: run on Python scripts not ending with .py
Browse files Browse the repository at this point in the history
When running flake8 on a directory, it does not analyze files without an
extension, like semanage_migrate_store, mlscolor-test, etc. Use grep to
find files with a Python shebang and build a list which is then given to
flake8.

This commit is possible now that some clean-up patches have been
applied, such as commit 69c56bd ("python/chcat: improve the code
readability") and b7227aa ("mcstrans: fix Python linter warnings on
test scripts") and 3cb974d ("semanage_migrate_store: fix many
Python linter warnings").

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
  • Loading branch information
fishilico authored and bachradsusi committed Jan 8, 2019
1 parent aa3ddfe commit bb518a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/run-flake8
Expand Up @@ -4,6 +4,11 @@
# Run on the base directory if no argument has been given
if [ $# -eq 0 ] ; then
cd "$(dirname -- "$0")/.." || exit $?

# Run on both files ending with .py and Python files without extension
# shellcheck disable=SC2046
set -- $( (find . -name '*.py' ; grep --exclude-dir=.git -l -e '^#!\s*/usr/bin/python' -e '^#!/usr/bin/env python' -r .) | sort -u )
echo "Analyzing $# Python scripts"
fi

# Assign each ignore warning on a line, in order to ease testing enabling the warning again
Expand Down

0 comments on commit bb518a0

Please sign in to comment.