Closed lorforlinux closed 4 years ago
Hey @deepaklorkhatri007, Please read the following log in order to understand the failure reason. It'll be awesome if you fix what's wrong and commit the changes.
Hi, how can I create a local setup for fixing the issue of formatting in examples?
@deepaklorkhatri007 in most cases, including this one (trailing space on line 44 of examples/ReadWrite/ReadWrite.ino
), just doing a Tools > Auto Format in the Arduino IDE will provide compliant formatting.
I think it would be nice to fix the trailing space in the example, but you don't need to worry about the non-compliant formatting in src/utility/SdFat.h
, as that was not caused by your PR.
Just in case you're interested in the details, or don't want to use the Arduino IDE:
The same formatter tool is used for this CI build as the Arduino IDE: Artistic Style. You can download it here: https://sourceforge.net/projects/astyle/files installation instructions here: http://astyle.sourceforge.net/install.html
The configuration file we use for the CI builds is available here: https://raw.githubusercontent.com/arduino/Arduino/master/build/shared/examples_formatter.conf
The documentation for Artistic Style is here: http://astyle.sourceforge.net/astyle.html
If you wanted to format all .ino files recursively from the current directory, using the examples_formatter.conf configuration file, without making backups, the command would look something like this:
astyle --suffix=none --options="examples_formatter.conf" --recursive ./*.pde,*.ino
Hi @per1234, thank you so much for the details.
I think it would be nice to fix the trailing space in the example, but you don't need to worry about the non-compliant formatting in src/utility/SdFat.h, as that was not caused by your PR.
yes, the build was failing before my pull request.
just doing a Tools > Auto Format in the Arduino IDE will provide compliant formatting.
I will try to fix the issue :)
All checks are passing now, I am using Fedora Linux and astyle
is already installed on my machine. If it was not installed i may have used
sudo dnf install astyle
For fixing the formatting we can directly use the command suggested by @per1234 (I did it one by one to get to know the tool better)
For formatting all the files from in SD/ directory run
$ cd SD/
$ astyle --suffix=none --options="examples_formatter.conf" --recursive ./*.pde,*.ino -v
For doing it one by one run
$ cd {folder}
$ astyle --suffix=none --options="examples_formatter.conf" --recursive {file}.ino -v
Now I want to fix the code redundancy of the error message if everybody agrees on it. Basically I am going to create one function which we can use to see if the initialization is successful or not.
There is an incompatibility issue for showing the initialization error message for the examples.
The example
CardInfo.ino
has this code (which i personally like)While the other example, like the
ReadWrite.ino
uses this codeIt's a better idea to make one function in the library for doing this instead of writing similar code in all the examples. I will work on updating the library code if others agree with me on this :)