printrun-src/README.cleanup

Fri, 03 Jun 2016 09:16:07 +0200

author
mbayer
date
Fri, 03 Jun 2016 09:16:07 +0200
changeset 15
0bbb006204fc
permissions
-rw-r--r--

Added printrun sourcecode from
https://github.com/kliment/Printrun
03.06.2016 09:10

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

mercurial