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

style: add EditorConfig and format some files #2106

Merged

Conversation

flyingthingsintothings
Copy link
Contributor

Add an EditorConfig to make sure editors know how to correctly edit and save files. Also strip trailing whitespace in some files that don't need it, as configured in the EditorConfig file.

@flyingthingsintothings
Copy link
Contributor Author

flyingthingsintothings commented Apr 24, 2024

I checked files with grep and find to see what extensions there were, which files used what conventions and tried to add all the conventions in the EditorConfig file to enforce a more consistent style in the future. I also limited trim_trailing_whitespace to files that would normally never need trailing whitespace. There were also one PHP file and one CSS file which both had no final newline at the end of the file. I don't know whether that was on purpose as these are the only files of their type, so I couldn't check. I added exceptions for adding the newline for these two filestypes.

Having this file is especially handy when this code is used as a submodule where another EditorConfig file might set different settings. The editor always uses the EditorConfig that is closest to the edited file, which would be the one added here.

@hamishwillee
Copy link
Collaborator

@flyingthingsintothings Thank you so much - this is great. In particular, should fix some of those spurious formatting errors when working with new message definitions,

@julianoes I'm approving. But good to have a second pair of eyes so would appreciate you could do a check too.

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

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

Fine with me.

.editorconfig Outdated Show resolved Hide resolved
@julianoes
Copy link
Collaborator

@hamishwillee would be nice if your editor wouldn't leave trailing whitespace on save.

Add an EditorConfig to make sure editors know how to correctly edit and
save files. Also strip trailing whitespace in some files that don't need
it, as configured in the EditorConfig file.
@flyingthingsintothings
Copy link
Contributor Author

I added some rules to remove trailing whitespace on save but didn't do it for all files as I know it can be meaningful in some languages.

@hamishwillee
Copy link
Collaborator

@hamishwillee would be nice if your editor wouldn't leave trailing whitespace on save.

It certainly would :-)

Thanks @flyingthingsintothings - merging.

@hamishwillee hamishwillee merged commit 23eb98c into mavlink:master May 1, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants