Skip to content

Example code on reference pages do not follow the Arduino code format standard #6503

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

Open
per1234 opened this issue Jul 16, 2017 · 2 comments · Fixed by arduino/reference-en#529
Labels
Component: Documentation Related to Arduino's documentation content Library: Ethernet The Ethernet Arduino library Library: Other Arduino libraries that don't have their own label Library: SoftwareSerial The SoftwareSerial Arduino library Library: SPI The SPI Arduino library Type: Bug

Comments

@per1234
Copy link
Collaborator

per1234 commented Jul 16, 2017

Tools > Auto Format in the Arduino IDE has established a standard of formatting for all Arduino sketches. It's important to teach beginners to be consistent in whatever code formatting style they choose. Unfortunately Arduino's example code doesn't always follow their own standard.

I recommend using the "examples_formatter" script, or the Arduino IDE's Tools > Auto Format configured with the examples_formatter.conf file on all example code in the Arduino reference pages.

@per1234 per1234 added the Component: Documentation Related to Arduino's documentation content label Jul 16, 2017
@kengdahl
Copy link
Member

Hey. Could you give me an example of this from the examples?

@per1234
Copy link
Collaborator Author

per1234 commented Mar 22, 2018

Since it's now possible for anyone to improve the Language Reference pages I did a quick browse of some of the reference pages for the more popular Arduino libraries and found these (not a comprehensive list):

Although not enforced by Auto Format, I also find it quite unfortunate that there is no consistent brace style (broken/attached) anywhere in Arduino code. If a specific style convention was established then it would be easy to conform to. As things are now, I've wasted time trying to figure out which style is used in the majority of official Arduino code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation Related to Arduino's documentation content Library: Ethernet The Ethernet Arduino library Library: Other Arduino libraries that don't have their own label Library: SoftwareSerial The SoftwareSerial Arduino library Library: SPI The SPI Arduino library Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants