Created
February 24, 2012 19:09
-
-
Save perrygeo/1903033 to your computer and use it in GitHub Desktop.
Sed scripts to fix blank lines and whitespace; helps code comply with PEP8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Removes whitespace chars from blank lines | |
pep8 -r --select=W293 -q --filename=*.py /usr/local/src/madrona/madrona/ | xargs sed -i 's/^[ \r\t]*$//' | |
# Removes trailing blank lines from files | |
pep8 -r --select=W391 -q --filename=*.py /usr/local/src/madrona/madrona/ | xargs sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' | |
# Squashes consecutive blanks lines into one | |
pep8 -r --select=E303 -q --filename=*.py /usr/local/src/madrona/madrona/ | xargs sed -i '/./,/^$/!d' | |
# confirm | |
pep8 -r --select=W391,W293,E303 -q --filename=*.py /usr/local/src/madrona/madrona/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment