From bf1072c9022cd161b9cc4860e5403a463bc0e05b Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 9 Aug 2016 13:23:53 -0700 Subject: Make Spack core PEP8 compliant. --- share/spack/qa/run-flake8 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'share') 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 -- cgit v1.2.3-70-g09d2