diff --git a/.astylerc b/.astylerc new file mode 100644 index 0000000000..5de8f3527d --- /dev/null +++ b/.astylerc @@ -0,0 +1,46 @@ +## Formatting options for +## Astyle - Source code indenter, formatter, and beautifier for C, C++, and Java Source Code +## http://astyle.sourceforge.net/ + +# Indent as C/C++ +mode=c +# Use LF line end style +lineend=linux + +# Allman style formatting/indenting uses broken brackets +style=allman + +# Grant an exception to the Allman style bracketing for `extern "c"` statements. +attach-extern-c +# Attach while statement to closing bracket of a do {} while statment +attach-closing-while + +# Indent using 4 spaces per indent +indent=spaces=4 +convert-tabs +# Indent labels so they match the current indentation rather than being flush to the left +indent-labels +# Make sure all comments are indented with the code +indent-col1-comments +# No min indents for a header is built of multiple lines. This assures they are always aligned. +min-conditional-indent=0 +# Don't restrict the max contiunation indent as much as possible. Still, it shouldn't be close to 120 ever. +max-continuation-indent=120 + +# Insert space padding around operators and after commas +pad-oper +# Remove unnecessary padding around parentheses +unpad-paren +# Attach pointers and references to the variable name +align-pointer=name +# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...) +pad-header + +# Add braces to one-line conditional statements +add-braces +# Leave one-line blocks as-is. This should only be used with single statements. +keep-one-line-blocks + +# Exclude third-party libraries +exclude=miniz.cpp +exclude=miniz.h diff --git a/.travis.yml b/.travis.yml index cf7315e122..b4a5849370 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,7 @@ addons: - graphviz - python3 - python3-pip + - astyle before_install: - | @@ -57,7 +58,7 @@ before_install: if [ "$ver" -le "27" ]; then brew upgrade python; fi - brew install p7zip qt gpg; + brew install p7zip qt gpg astyle; brew link qt --force; fi @@ -70,10 +71,14 @@ install: - pip3 -V before_script: - - echo "are changes related to source code?" + - 'echo "Checking style guidelines"; + astyle -rn --project "./*.cpp" "./*.h"; + git diff; + git checkout -- .;' + - echo "Are changes related to source code?" - 'if [ "$TRAVIS_BRANCH" != "release" ]; then - bash $TRAVIS_BUILD_DIR/util/checkchanges.sh; - fi' + bash $TRAVIS_BUILD_DIR/util/checkchanges.sh; + fi' - 'if [ "$TRAVIS_OS_NAME" == "linux" ]; then . /opt/qt59/bin/qt59-env.sh; export DISPLAY=:99.0; diff --git a/util/qt_creator_code_style.xml b/util/qt_creator_code_style.xml new file mode 100644 index 0000000000..2f8d3f3f6f --- /dev/null +++ b/util/qt_creator_code_style.xml @@ -0,0 +1,40 @@ + + + + + + CodeStyleData + + true + false + true + false + false + false + false + false + true + false + false + false + true + true + false + true + false + false + false + 4 + true + false + 2 + false + true + 4 + + + + DisplayName + Pencil2D + +