Use consistent formatting of all code #529
Merged
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.
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:
Partially fixes arduino/Arduino#6503 (the same still needs to be done for library reference pages)