Skip to content

prepare allman style #5774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/astyle_core.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Code formatting rules for Arduino examples, taken from:
#
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
#

mode=c
lineend=linux
style=allman

# 4 spaces indentation
indent=spaces=4

# also indent macros
#indent-preprocessor

# indent classes, switches (and cases), comments starting at column 1
indent-col1-comments

# put a space around operators
pad-oper

# put a space after if/for/while
pad-header

# if you like one-liners, keep them
keep-one-line-statements

attach-closing-while
unpad-paren
pad-oper
remove-comment-prefix
add-braces
File renamed without changes.
6 changes: 2 additions & 4 deletions tests/ci/style_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

set -ev

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

# Revert changes which astyle might have done to the submodules,
# as we don't want to fail the build because of the 3rd party libraries
Expand Down
3 changes: 0 additions & 3 deletions tests/examples_restyle.sh

This file was deleted.

31 changes: 31 additions & 0 deletions tests/restyle-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

set -e

org=$(cd ${0%/*}; pwd)
cd ${org}/..
pwd
test -d cores/esp8266
test -d libraries

# this warning question will be removed after restyle-all.sh is renamed to restyle.sh
echo "This is dangerous if you have modified your local repository"
echo "type iknowwhatido to continue"
read ans
test "$ans" = iknowwhatido || exit 1

for d in cores/esp8266 libraries; do
for e in c cpp h; do
find $d -name "*.$e" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_core.conf {} \;
done
done

for d in libraries; do
find $d -name "*.ino" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_examples.conf {} \;
done
19 changes: 19 additions & 0 deletions tests/restyle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -e

org=$(cd ${0%/*}; pwd)
cd ${org}/..
pwd
test -d cores/esp8266
test -d libraries

# in a near future, restyle-all.sh will be renamed to restyle.sh
# and will be checked against CI

for d in libraries; do
find $d -name "*.ino" -exec \
astyle \
--suffix=none \
--options=${org}/astyle_examples.conf {} \;
done