Make Spack core PEP8 compliant.

This commit is contained in:
Todd Gamblin
2016-08-09 13:23:53 -07:00
parent 8061deb883
commit bf1072c902
150 changed files with 1436 additions and 1160 deletions

View File

@@ -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