forked from danmar/cppcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runastyle
executable file
·48 lines (41 loc) · 1.65 KB
/
runastyle
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/bash
# The version check in this script is used to avoid commit battles
# between different developers that use different astyle versions as
# different versions might have different output (this has happened in
# the past).
# If project management wishes to take a newer astyle version into use
# just change this string to match the start of astyle version string.
ASTYLE_VERSION="Artistic Style Version 2.05.1"
ASTYLE="astyle"
DETECTED_VERSION=`$ASTYLE --version 2>&1`
if [[ "$DETECTED_VERSION" != ${ASTYLE_VERSION}* ]]; then
echo "You should use: ${ASTYLE_VERSION}";
echo "Detected: ${DETECTED_VERSION}"
exit 1;
fi
style="--style=stroustrup --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0"
options="--options=none --pad-header --unpad-paren --suffix=none --convert-tabs --attach-inlines"
$ASTYLE $style $options cli/*.cpp
$ASTYLE $style $options cli/*.h
$ASTYLE $style $options democlient/*.cpp
$ASTYLE $style $options gui/*.cpp
$ASTYLE $style $options gui/*.h
$ASTYLE $style $options -r gui/test/*.cpp
$ASTYLE $style $options -r gui/test/*.h
$ASTYLE $style $options lib/*.cpp
$ASTYLE $style $options lib/*.h
$ASTYLE $style $options test/*.cpp
$ASTYLE $style $options test/cfg/*.c*
$ASTYLE $style $options test/*.h
$ASTYLE $style $options tools/*.cpp
$ASTYLE $style $options --recursive "samples/*.c"
$ASTYLE $style $options --recursive "samples/*.cpp"
# Convert tabs to spaces.. even in strings
# sed -i "s/\t/ /g" test/test*.cpp
# format config files
# TODO: use other tool than xmllint? use tabs instead of spaces?
for CFGFILE in cfg/*.cfg
do
xmllint --format -o ${CFGFILE}_ ${CFGFILE}
mv -f ${CFGFILE}_ ${CFGFILE}
done