diff options
Diffstat (limited to 'share')
-rwxr-xr-x | share/spack/qa/run-flake8 | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/share/spack/qa/run-flake8 b/share/spack/qa/run-flake8 index 595df417ec..c59bfc9490 100755 --- a/share/spack/qa/run-flake8 +++ b/share/spack/qa/run-flake8 @@ -22,9 +22,13 @@ changed=$(git diff --name-only --find-renames develop... | grep '.py$') # Add approved style exemptions to the changed packages. for file in $changed; do - if [[ $file = *package.py ]]; then - cp "$file" "$file~" + # Make a backup to restore later + cp "$file" "$file.sbak~" + # + # Exemptions for package.py files + # + if [[ $file = *package.py ]]; then # Exempt lines with urls and descriptions from overlong line errors. perl -i -pe 's/^(\s*homepage\s*=.*)$/\1 # NOQA: ignore=E501/' $file perl -i -pe 's/^(\s*url\s*=.*)$/\1 # NOQA: ignore=E501/' $file @@ -36,6 +40,11 @@ for file in $changed; do # Exempt '@when' decorated functions from redefinition errors. perl -i -pe 's/^(\s*\@when\(.*\).*)$/\1 # NOQA: ignore=F811/' $file fi + + # + # Exemptions for all files + # + perl -i -pe 's/^(.*(https?|file)\:.*)$/\1 # NOQA: ignore=E501/' $file done return_code=0 @@ -58,8 +67,8 @@ fi # Restore original package files after modifying them. for file in $changed; do - if [[ $file = *package.py ]]; then - mv "${file}~" "${file}" + if [[ -e "${file}.sbak~" ]]; then + mv "${file}.sbak~" "${file}" fi done |