Skip to content
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

PFW-1051: Introduce an editorconfig file #1752

Merged
merged 1 commit into from Nov 4, 2019

Conversation

wavexx
Copy link
Collaborator

@wavexx wavexx commented Apr 19, 2019

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:

  • basic indentation width
  • tab vs spaces
  • tab width
  • default charset

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).

@wavexx
Copy link
Collaborator Author

wavexx commented Apr 26, 2019

FIY: arduino/Arduino#8804

Copy link

@GurliGebis GurliGebis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes great sense, since it helps different editors treat the files the same.

@DRracer DRracer merged commit 1a0c248 into prusa3d:MK3 Nov 4, 2019
@wavexx wavexx deleted the introduce_editorconfig branch November 9, 2019 17:16
@DRracer DRracer changed the title Introduce an editorconfig file PFW-1051: Introduce an editorconfig file Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants