-
Notifications
You must be signed in to change notification settings - Fork 3k
Add AStyle definition file and travis astyle check #6014
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
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fe7569d
Add Astyle configuration file for mbed OS
0xc0170 82e8aa0
Add astyleignore file
0xc0170 44bd7b0
Travis: add astyle
0xc0170 ac9f57a
test: fix inline assembly formatting - disable astyle
0xc0170 8a341f1
AStyle: options update
0xc0170 bc5f843
platform: astyle update
0xc0170 453da17
hal: astyle update
0xc0170 f99f9dc
feature storage: astyle update
0xc0170 15fe790
netsocket: astyle update
0xc0170 b502faa
nanostack: astyle update
0xc0170 0dd6aba
lorawan: astyle update
0xc0170 0a4cd64
filesystem: astyle update
0xc0170 b15554c
uvisor: astyle update
0xc0170 774aa9c
events: astyle update
0xc0170 9f5058a
drivers: astyle update
0xc0170 1743833
TESTS: astyle update
0xc0170 5c945b3
ble: astyle update
0xc0170 6d8dd0c
rtos: astyle update
0xc0170 35d03a6
celullar: astyle update
0xc0170 a1cb121
nvstore: astyle update
0xc0170 ef9dbc5
astyle update to new files
0xc0170 83b47ef
Astyle: Changed from test failure to status note
geky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
BUILD | ||
cmsis | ||
features/mbedtls | ||
features/FEATURE_LWIP/lwip | ||
rtos/TARGET_CORTEX/rtx4 | ||
features/filesystem/littlefs/littlefs | ||
features/filesystem/fat/ChaN | ||
features/frameworks | ||
features/FEATURE_BLE/targets | ||
features/FEATURE_LWIP/lwip-interface/lwip | ||
features/unsupported/ | ||
features/FEATURE_COMMON_PAL/ | ||
FEATURE_NANOSTACK/coap-service | ||
FEATURE_NANOSTACK/sal-stack-nanostack | ||
rtos/TARGET_CORTEX/rtx5 | ||
targets | ||
tools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Mbed OS code style definition file for astyle | ||
|
||
# Don't create backup files, let git handle it | ||
suffix=none | ||
|
||
# K&R style | ||
style=kr | ||
|
||
# 1 TBS addition to k&r, add braces to one liners | ||
# Use -j as it was changed in astyle from brackets to braces, this way it is compatible with older astyle versions | ||
-j | ||
|
||
# 4 spaces, convert tabs to spaces | ||
indent=spaces=4 | ||
convert-tabs | ||
|
||
# Indent switches and cases | ||
indent-switches | ||
indent-cases | ||
|
||
# Remove spaces in and around parentheses | ||
unpad-paren | ||
|
||
# Insert a space after if, while, for, and around operators | ||
pad-header | ||
pad-oper | ||
|
||
# Pointer/reference operators go next to the name (on the right) | ||
align-pointer=name | ||
align-reference=name | ||
|
||
# Attach { for classes and namespaces | ||
attach-namespaces | ||
attach-classes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious about this so I tried astyle with both brace styles:
It would actually take fewer code changes to change the existing KR braces than to standardize on KR. We should reconsider our stance on brace placement.
I've never understood why our brace style is inconsistent between functions and every other syntactic construct.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have testing online compiler - we need to match what we have here and what online compiler does. It seems it defines a rule to actually attach
{
in the header files, will run few more tests and get its options that it defines (only for C++ functions), AStyle has this option (attach-inlines) that seems to be active in the online compilerThe line 59 is correct, what we need to align is C++ inlines. From experience, not always it was clear when to attach
{
for users thus our initial coding style set it always new line for functions (no matter if C++ or C). This however as we can see it is not aligned with online compiler, will checkThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this PR, attached C++ as the online compiler does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This contradict the guidelines and guidelines are made to be followed; the purpose of this PR is to enforce them. If the online compiler is wrong; fix the online compiler. Not the other way around.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KR style braces are still the minority, although only slightly:
I'm suggesting we change the guidelines to match the style of code users are contributing. I had no idea C++ inlines are a separate style, and if we don't know what our rules are on braces how are our users supposed to?
I mean what is this:
What's the reason for not making squiggly brackets consistent?