Skip to content

Use consistent formatting of all code #529

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 1 commit into from
Feb 19, 2019
Merged

Use consistent formatting of all code #529

merged 1 commit into from
Feb 19, 2019

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Feb 6, 2019

Inconsistent code formatting is confusing to beginners who may not understand which code differences are purely aesthetic. Inconsistency also breeds more inconsistency and inefficiency as contributors of example code struggle to determine any style convention to follow in their work.

AStyle (the tool used for the Arduino IDE's Auto Format feature) was used to automatically format the example code in the reference pages according to the standard Arduino style established in the official example sketches bundled with the Arduino IDE. The Auto Format formatting settings were used in addition to Arduino example formatter configuration:
https://github.com/arduino/Arduino/blob/1.8.8/build/shared/examples_formatter.conf
I used the latest version of AStyle, which offers some new configuration settings that allow enhanced compliance with the Arduino code style:

mode=c

style=attach

break-closing-braces
attach-closing-while
attach-namespaces
attach-classes
attach-inlines
attach-extern-c

indent=spaces=2
indent-classes
indent-switches
indent-cases
indent-col1-comments
indent-modifiers
indent-namespaces
indent-labels
indent-preproc-define

pad-header
pad-oper
unpad-paren

add-braces

remove-comment-prefix
convert-tabs
align-pointer=name

Partially fixes arduino/Arduino#6503 (the same still needs to be done for library reference pages)

@robsoncouto
Copy link
Contributor

@per1234, could you kindly fix the conflicts on this one?

Inconsistent code formatting is confusing to beginners who may not understand which code differences are purely aesthetic. Inconsistency also breeds more inconsistency and inefficiency as contributers of example code struggle to determine any style convention to follow in their work.

AStyle (the tool used for the Arduino IDE's Auto Format feature) was used to automatically format the example code in the reference pages according to the standard Arduino style established in the official example sketches bundled with the Arduino IDE. The Auto Format formatting settings were used in addition to Arduino example formatter configuration:
https://github.com/arduino/Arduino/blob/1.8.8/build/shared/examples_formatter.conf
I used the latest version of AStyle, which offers some new configuration settings that allow enhanced compliance with the Arduino code style:

mode=c

style=attach

break-closing-braces
attach-closing-while
attach-namespaces
attach-classes
attach-inlines
attach-extern-c

indent=spaces=2
indent-classes
indent-switches
indent-cases
indent-col1-comments
indent-modifiers
indent-namespaces
indent-labels
indent-preproc-define

pad-header
pad-oper
unpad-paren

add-braces

remove-comment-prefix
convert-tabs
align-pointer=name
@per1234
Copy link
Collaborator Author

per1234 commented Feb 19, 2019

I have resolved the merge conflicts via a force push. Thanks for having a look at this.

@robsoncouto robsoncouto merged commit f3eced4 into arduino:master Feb 19, 2019
@robsoncouto
Copy link
Contributor

Awesome! Thanks.
Merged

@per1234 per1234 deleted the consistent-code-formatting branch February 19, 2019 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example code on reference pages do not follow the Arduino code format standard
2 participants