1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

prepare allman style (#5774)

This commit is contained in:
david gauchard 2019-02-18 01:10:44 +01:00 committed by GitHub
parent b93b37fb81
commit e7e7a4da17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 84 additions and 7 deletions

32
tests/astyle_core.conf Normal file
View File

@ -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

View File

@ -4,10 +4,8 @@
set -ev set -ev
find $TRAVIS_BUILD_DIR/libraries -name '*.ino' -exec \ org=$(cd ${0%/*}; pwd)
astyle \ ${org}/../restyle.sh
--suffix=none \
--options=$TRAVIS_BUILD_DIR/tests/examples_style.conf {} \;
# Revert changes which astyle might have done to the submodules, # 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 # as we don't want to fail the build because of the 3rd party libraries

View File

@ -1,3 +0,0 @@
#!/bin/bash
cd $(cd ${0%/*}; pwd)
astyle --options=examples_style.conf ../libraries/*/examples/*{,/*}/*.ino

31
tests/restyle-all.sh Executable file
View File

@ -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
tests/restyle.sh Executable file
View File

@ -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