From 9ad5dfc928dc4530feb7353d43c7364e7ca5e9e4 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Tue, 18 Aug 2015 11:40:01 +0200 Subject: [PATCH] moving astyle options into astyle options file, adding sublime settings for astyle formatter plugin --- Firmware.sublime-project | 15 ++++++++++++++- Tools/astylerc | 18 ++++++++++++++++++ Tools/fix_code_style.sh | 20 ++------------------ 3 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 Tools/astylerc diff --git a/Firmware.sublime-project b/Firmware.sublime-project index b061aa68d8..c9cb9cfc02 100644 --- a/Firmware.sublime-project +++ b/Firmware.sublime-project @@ -33,7 +33,20 @@ { "tab_size": 8, "translate_tabs_to_spaces": false, - "highlight_line": true + "highlight_line": true, + "AStyleFormatter": + { + "options_c": + { + "use_only_additional_options": true, + "additional_options_file": "${project_path}/Tools/astylerc" + }, + "options_c++": + { + "use_only_additional_options": true, + "additional_options_file": "${project_path}/Tools/astylerc" + } + } }, "build_systems": [ diff --git a/Tools/astylerc b/Tools/astylerc new file mode 100644 index 0000000000..efdc279ca9 --- /dev/null +++ b/Tools/astylerc @@ -0,0 +1,18 @@ +indent=force-tab=8 +style=linux +indent-preprocessor +indent-cases +break-blocks=all +pad-oper +pad-header +unpad-paren +keep-one-line-blocks +keep-one-line-statements +align-pointer=name +align-reference=name +-n #--suffix=none +ignore-exclude-errors-x +lineend=linux +exclude=EASTL +add-brackets +max-code-length=120 diff --git a/Tools/fix_code_style.sh b/Tools/fix_code_style.sh index e73a5a8af2..f1818f2f54 100755 --- a/Tools/fix_code_style.sh +++ b/Tools/fix_code_style.sh @@ -1,22 +1,6 @@ #!/bin/sh +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) astyle \ - --style=linux \ - --indent=force-tab=8 \ - --indent-cases \ - --indent-preprocessor \ - --break-blocks=all \ - --pad-oper \ - --pad-header \ - --unpad-paren \ - --keep-one-line-blocks \ - --keep-one-line-statements \ - --align-pointer=name \ - --align-reference=name \ - --suffix=none \ - --ignore-exclude-errors-x \ - --lineend=linux \ - --exclude=EASTL \ - --add-brackets \ - --max-code-length=120 \ + --options=$DIR/astylerc \ --preserve-date \ $*