Skip to content

Commit e7e7a4d

Browse files
authored
prepare allman style (#5774)
1 parent b93b37f commit e7e7a4d

File tree

6 files changed

+84
-7
lines changed

6 files changed

+84
-7
lines changed

tests/astyle_core.conf

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Code formatting rules for Arduino examples, taken from:
2+
#
3+
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
4+
#
5+
6+
mode=c
7+
lineend=linux
8+
style=allman
9+
10+
# 4 spaces indentation
11+
indent=spaces=4
12+
13+
# also indent macros
14+
#indent-preprocessor
15+
16+
# indent classes, switches (and cases), comments starting at column 1
17+
indent-col1-comments
18+
19+
# put a space around operators
20+
pad-oper
21+
22+
# put a space after if/for/while
23+
pad-header
24+
25+
# if you like one-liners, keep them
26+
keep-one-line-statements
27+
28+
attach-closing-while
29+
unpad-paren
30+
pad-oper
31+
remove-comment-prefix
32+
add-braces
File renamed without changes.

tests/ci/style_check.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
set -ev
66

7-
find $TRAVIS_BUILD_DIR/libraries -name '*.ino' -exec \
8-
astyle \
9-
--suffix=none \
10-
--options=$TRAVIS_BUILD_DIR/tests/examples_style.conf {} \;
7+
org=$(cd ${0%/*}; pwd)
8+
${org}/../restyle.sh
119

1210
# Revert changes which astyle might have done to the submodules,
1311
# as we don't want to fail the build because of the 3rd party libraries

tests/examples_restyle.sh

-3
This file was deleted.

tests/restyle-all.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
org=$(cd ${0%/*}; pwd)
6+
cd ${org}/..
7+
pwd
8+
test -d cores/esp8266
9+
test -d libraries
10+
11+
# this warning question will be removed after restyle-all.sh is renamed to restyle.sh
12+
echo "This is dangerous if you have modified your local repository"
13+
echo "type iknowwhatido to continue"
14+
read ans
15+
test "$ans" = iknowwhatido || exit 1
16+
17+
for d in cores/esp8266 libraries; do
18+
for e in c cpp h; do
19+
find $d -name "*.$e" -exec \
20+
astyle \
21+
--suffix=none \
22+
--options=${org}/astyle_core.conf {} \;
23+
done
24+
done
25+
26+
for d in libraries; do
27+
find $d -name "*.ino" -exec \
28+
astyle \
29+
--suffix=none \
30+
--options=${org}/astyle_examples.conf {} \;
31+
done

tests/restyle.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
org=$(cd ${0%/*}; pwd)
6+
cd ${org}/..
7+
pwd
8+
test -d cores/esp8266
9+
test -d libraries
10+
11+
# in a near future, restyle-all.sh will be renamed to restyle.sh
12+
# and will be checked against CI
13+
14+
for d in libraries; do
15+
find $d -name "*.ino" -exec \
16+
astyle \
17+
--suffix=none \
18+
--options=${org}/astyle_examples.conf {} \;
19+
done

0 commit comments

Comments
 (0)