summaryrefslogtreecommitdiff
path: root/scripts/codingstyle.sh
blob: b35d943366b24fc50b8406e765eff2a988861923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
# apply rekonq coding style to all cpp and header files in src directory 
#
# requirements: installed astyle 
# 
# rekonq use kdelibs coding style, except for brackets, so while kdelibs coding style
# is
#
# void foo() {
# ...
# }
#
# rekonq uses
#
# void foo()
# {
#   ...
# }
#
# I like this way, for me more readable. :)
#
# Kdelibs coding style is defined in http://techbase.kde.org/Policies/Kdelibs_Coding_Style 


PWD=$(pwd)

cd $PWD
cd ..

echo "Applying astyle rules..."
astyle \
--indent=spaces=4 \
--style=allman \
--indent-labels \
--pad-oper \
--pad-header \
--unpad-paren \
--keep-one-line-statements \
--convert-tabs \
--indent-preprocessor \
`find -type f -name '*.cpp'` `find -type f -name '*.h'`

echo "Removing .orig files..."
rm *.orig */*.orig

echo "Done!"