Skip to content

Add trim_trailing_whitespace to .editorconfig [skip ci]#1332

Merged
seanmcleod70 merged 2 commits intoJSBSim-Team:masterfrom
seanmcleod70:TrimTrailingWhiteSpace
Sep 10, 2025
Merged

Add trim_trailing_whitespace to .editorconfig [skip ci]#1332
seanmcleod70 merged 2 commits intoJSBSim-Team:masterfrom
seanmcleod70:TrimTrailingWhiteSpace

Conversation

@seanmcleod70
Copy link
Contributor

@bcoconni mentioned:

And sorry, my IDE cleans up trailing spaces before saving files so there are a few white spaces modifications that are polluting the diff.

So I've added trim_trailing_whitespace = true to .editorconfig to try and improve consistency. Not guaranteed since someone may use an editor that doesn't support .editorconfig. If we did want to guarantee this sort of formatting we'd need to use some tool tied to our CI pipeline.

@bcoconni your examples of removing trailing whitespace were for Python code in .ipynb files. I noticed that currently our .editorconfig is only configured for .h .hpp .cpp files. So I guess we should also add an entry for .py files? Looks like our default there is space for indents, but 4 spaces as opposed to 2?

@seanmcleod70 seanmcleod70 changed the title Add trim_trailing_whitespace to .editorconfig Add trim_trailing_whitespace to .editorconfig [skip_ci] Sep 7, 2025
@codecov
Copy link

codecov bot commented Sep 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 24.91%. Comparing base (f3f59eb) to head (aee4d9f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1332   +/-   ##
=======================================
  Coverage   24.91%   24.91%           
=======================================
  Files         169      169           
  Lines       19675    19675           
=======================================
  Hits         4902     4902           
  Misses      14773    14773           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bcoconni
Copy link
Member

bcoconni commented Sep 9, 2025

your examples of removing trailing whitespace were for Python code in .ipynb files. I noticed that currently our .editorconfig is only configured for .h .hpp .cpp files. So I guess we should also add an entry for .py files?

Well, I have set VS Code to automatically trim trailing spaces on savingno matter what the file extension is. However I guess that for .editorconfig we could extend the trailing spaces removal to .py files ?

Looks like our default there is space for indents, but 4 spaces as opposed to 2?

Indeed, I guess I've used the default indent of VS Code (i.e 4 spaces) for the first Python files I've created. I have this impression that, generally speaking, 4 spaces is quite standard for Python whereas C and C++ are more in the "2 spaces" team.

@seanmcleod70 seanmcleod70 changed the title Add trim_trailing_whitespace to .editorconfig [skip_ci] Add trim_trailing_whitespace to .editorconfig [skip ci] Sep 9, 2025
@seanmcleod70
Copy link
Contributor Author

Okay I've pushed a commit to add an entry for Python files to .editorconfig.

Also used a trailing [skip ci] in the commit message and it does look like this has skipped the running of the workflow?

whereas C and C++ are more in the "2 spaces" team.

Must say I always found the JSBSim standard of only 2 spaces much smaller than I was used to for all the other C++ code I'd worked on where it was more on the order of 3-4 spaces. One of the reasons I originally added .editorconfig to the JSBSim repo, so that I could continue using larger indents on my other C++ code and not forget the smaller indent for JSBSim.

@bcoconni
Copy link
Member

Must say I always found the JSBSim standard of only 2 spaces much smaller than I was used to for all the other C++ code I'd worked on where it was more in the order of 3-4 spaces.

Ah OK. I had this impression because C++ is quite verbose, especially when using templates, and that using 2 spaces indentation would help to avoid hitting the 80 columns limit which is AFAIK another standard limit that is used for code formatting.

@bcoconni
Copy link
Member

And the PR looks good to me 👍

@seanmcleod70 seanmcleod70 merged commit 405c00d into JSBSim-Team:master Sep 10, 2025
bcoconni pushed a commit to bcoconni/jsbsim that referenced this pull request Feb 6, 2026
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.

3 participants