Sat, 23 Sep 2017 10:27:49 +0200
Added more default options
Code cleanup
15 | 1 | Some cleanup commands: |
2 | ||
3 | To add a space after each comma: | |
4 | sed -e "s/\(\w\),\(\w\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
5 | sed -e "s/\(\w\),\(\"\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
6 | sed -e "s/\(\"\),\(\w\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
7 | sed -e "s/\(\"\),\(\"\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
8 | sed -e "s/\([)}\]]\),\(\w\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
9 | sed -e "s/\([)}\]]\),\([\[{(]\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
10 | sed -e "s/\(\w\),\([\[{(]\)/\1, \2/g" -i *.py printrun/*.py printrun/*/*.py | |
11 | ||
12 | To add spaces around each =: | |
13 | sed -e "s/\(\w\)=\(\w\)/\1 = \2/g" -i *.py printrun/*.py printrun/*/*.py | |
14 | sed -e "s/\(\w\)=\(\"\)/\1 = \2/g" -i *.py printrun/*.py printrun/*/*.py | |
15 | sed -e "s/\(\w\)=\((\)/\1 = \2/g" -i *.py printrun/*.py printrun/*/*.py | |
16 | sed -e "s/\(\w\)=\((\)/\1 = \2/g" -i *.py printrun/*.py printrun/*/*.py | |
17 | sed -e "s/\(\w\)=\([\[{(]\)/\1 = \2/g" -i *.py printrun/*.py printrun/*/*.py | |
18 | ||
19 | To add spaces around each ==: | |
20 | sed -e "s/\(\w\)==\(\w\)/\1 == \2/g" -i *.py printrun/*.py printrun/*/*.py | |
21 | sed -e "s/\(\w\)==\(\"\)/\1 == \2/g" -i *.py printrun/*.py printrun/*/*.py | |
22 | sed -e "s/\(\w\)==\((\)/\1 == \2/g" -i *.py printrun/*.py printrun/*/*.py | |
23 | sed -e "s/\()\)==\(\w\)/\1 == \2/g" -i *.py printrun/*.py printrun/*/*.py | |
24 | sed -e "s/\()\)==\((\)/\1 == \2/g" -i *.py printrun/*.py printrun/*/*.py | |
25 | ||
26 | Obviously this is not a perfect solution, it WILL break the code. Juste check the diff and fix what's wrong before commiting. | |
27 | ||
28 | Flake8 checking: | |
29 | Flake8 can be used to check the coding style of the project. | |
30 | The current source code (as of July 23rd 2013) has been checked using the following command: | |
31 | flake8 . --statistics --count --ignore=E251,E701,E302,E501 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,./printrun/cairosvg | |
32 | This call ignores 4 kind of errors (E501: line being greater than 80 chars, | |
33 | E701: multiple statements on one line (usually this is if ...: ...), E302: | |
34 | wrong number of blank lines between functions, E251: unexpected spaces around | |
35 | keywoard/parameter equals), the rest of the errors and warnings should be | |
36 | killed as much as possible. Long lines should be avoided too. |