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.
This PR adds the
uncrustify
configuration file.You can install the uncrustify binary on Mac OSX, Linux and Windows
sudo apt install uncrustify
brew install uncrustify
Alternatively you can clone the repo and compile the project yourself (latest version)
To run it on your code use:
uncrustify -c uncrustify-openwsn.cfg -f $FilePath -o $FilePath
(makes the changes in-place)I've applied the configuration to a bunch of files in the firmware project and I think the resulting layout looks nice, is properly aligned, and most importantly, improves code readability.
There are a lot of configuration options (700+) and they are all listed here: . Some options seem to override other ones. The latter can sometimes lead to weird formatting. I tried my best to remove contradicting configuration options, but it is possible some remain.
Before we reformat the entire FW repo, I propose that the people who are developing firmware code first try the uncrustify configuration on their local working trees and see if the configuration makes sense (and if they personally agree with the proposed code layout). If we see that it works well on all the files and we've converged on a fixed code layout/style, we can reformat the entire project once. Next, we can add the uncrustify configuration to the Travis builder to enforce future PRs to adhere to the coding style.