PFW-1051: Introduce an editorconfig file #1752
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.
This is both a PR and RFC. The overall indentation status of the sources is ... messy :(
It think it could be improved a lot with minimal effort by at least providing some defaults for newly submitted code.
In this PR we add an "editorconfig" file, which just states the basic preferred values of:
Nothing fancy, and it's zero effort.
The editorconfig is a simplified alternative to the vi/emacs modeline, and partially to vimrc or emacs's dirlocal files. I wasn't aware of this until a few weeks ago, when I noticed that editorconfig is supported by several popular windows editors.
It is fully advisory, so there's no harm in introducing this file. I've set the parameters to what the sources seem to use the most. I get more lines to line-up with tab set at 4 spaces, and the indentation is also mostly 4 as well. Trailing-whitespace-cleanup is turned on, which will result in cleaner files over time (although you'll see a lot of whitespace changes as files get saved).
emacs supports editorconfig through an elpa package, while newer vim versions should have this by default. But I could also supply an .exrc and .dirlocals file.
At least these will set the correct tab width, which will make the sources a bit more readable by default. The Arduino IDE doesn't seem to support those yet, but I'm going to create an issue for this too (so hopefully this will get even better).