Uncrustify configuration - #513
Draft
TimothyClaeys wants to merge 1 commit into
Draft
Conversation
Member
Author
|
Hi @kyh-ly, I don't think the branch |
|
@TimothyClaeys Sorry I don't have access to open issues, please tell me how to do this. 😄 |
Member
Author
|
@kyh-ly Sorry, apparently, the issues tab was disabled. I enabled it now. If you go the repository's main page: You should now see an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
uncrustifyconfiguration file.You can install the uncrustify binary on Mac OSX, Linux and Windows
sudo apt install uncrustifybrew install uncrustifyAlternatively 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.