Skip to content

Comments

CQ: Add .editorconfig and validate repo against it#4792

Draft
echoix wants to merge 21 commits intoOSGeo:mainfrom
echoix:editorconfig-checker
Draft

CQ: Add .editorconfig and validate repo against it#4792
echoix wants to merge 21 commits intoOSGeo:mainfrom
echoix:editorconfig-checker

Conversation

@echoix
Copy link
Member

@echoix echoix commented Dec 1, 2024

To be rebased after #4790 and #4791, to drop repeated commits. This is intended to be a draft, and would like to separate the change of line endings stored to CRLF for some files (plus the .gitattributes file change) to be in another commit, easier to cherry-pick afterwards.

With an .editorconfig file, most editors will adjust some preferences to match these settings. For example, setting to trim lines on some file types will have the whitespace trimmed when saving the file, preventing the situation where I regularly need to remove some files that slept through, as we had no CI to enforce it. Setting whether spaces or tabs are used, the indent size, whether to always ensure a new line is present on save. Plugins can accept more domain-specific settings, but appart from the couple of basic properties that are supported by all implementations, the rest is more like a preference if the plugins support the custom properies. For example, Intellij (Pycharm) uses many keys supported only by them, and in CSharp+Visual Basic, editorconfig files are used to select ALL the formatting choices and enable/silence/change the severity of some warnings, supported with more than just the Visual Studio IDE.

This PR:

@echoix echoix requested a review from neteler December 1, 2024 04:14
@echoix echoix marked this pull request as draft December 1, 2024 04:15
@github-actions github-actions bot added windows Microsoft Windows specific CI Continuous integration vector Related to vector data processing HTML Related code is in HTML database Related to database management libraries module docs raster3d labels Dec 1, 2024
@echoix
Copy link
Member Author

echoix commented Dec 2, 2024

Theres 7 bat files to change line endings too

@echoix echoix force-pushed the editorconfig-checker branch 2 times, most recently from 3ea0708 to ba1d323 Compare December 8, 2024 23:17
@echoix echoix force-pushed the editorconfig-checker branch 2 times, most recently from a9c81e7 to 025c29b Compare December 22, 2024 14:27
@github-actions github-actions bot added the JavaScript Related code is in JavaScript label Dec 22, 2024
@echoix echoix marked this pull request as ready for review January 2, 2025 17:39
@echoix echoix force-pushed the editorconfig-checker branch from 5e4269f to 6680322 Compare January 23, 2025 14:31
@echoix echoix mentioned this pull request Feb 17, 2025
@echoix echoix marked this pull request as draft February 18, 2025 03:08
@github-actions github-actions bot added the GUI wxGUI related label Feb 18, 2025
@echoix echoix marked this pull request as ready for review February 18, 2025 03:20
@echoix echoix added the conflicts/needs rebase Rebase to or merge with the latest base branch is needed label Feb 26, 2025
@echoix echoix mentioned this pull request Mar 1, 2025
1 task
echoix added a commit that referenced this pull request Jul 17, 2025
…6070)

Simplified and adapted from  #4792.
Fixes #6066 (comment)

The action that checks for CRLF has been failing since at least this weekend.
Considering that that action has low chances of beeing fixed in a timely matter, I replaced the functionality with an .editorconfig file and validating against it with editorconfig-checker. Compared to #4792, here I don’t attempt to make the line ending changes persist in the repo through .gitattributes, and ignore a bit more of non-ready config sections (since the functionality replaced was less detailed than what the .editorconfig I already had almost working).


I made the pre-commit run always, and made it faster in consequence to not add a big impact. With hot cache, it is taking 1min-1min10, which is about the same. I knew pre-commit could be faster in CI as I already saw how fast it was in ruff’s own CI when submitting one of my PRs there once. It can still be a bit faster, but it’s enough for today.

* CQ: Add initial .editorconfig file with basic settings

* CI: Add EditorConfig validation to super-linter workflow

* CI: Remove CRLF check from additional_checks.yml workflow

* CQ: Add editorconfig-checker to pre-commit config

* CI: Always run pre-commit in CI

* Update .editorconfig with new whitespace settings for mswindows

* CI: Run pre-commit step with uvx

* CI: Add caching for pre-commit checks in workflow

* Update .editorconfig for Windows batch files

* CI: Remove paths-filter step from additional_checks.yml

* Update additional_checks.yml step setup-uv
@wenzeslaus
Copy link
Member

@echoix Anything still useful here?

@neteler neteler requested review from wenzeslaus and removed request for neteler August 9, 2025 06:41
@echoix echoix marked this pull request as draft August 9, 2025 22:04
@echoix echoix removed the request for review from wenzeslaus August 9, 2025 22:04
@echoix
Copy link
Member Author

echoix commented Aug 9, 2025

@echoix Anything still useful here?

I’ll have to refresh it and take a new look, not now. I’m not sure of how I want pre-commit checks to work on Windows. And how the transition of contributor’s already checked out repos, how to validate that it’ll work as expected and what to document.

I’ll probably end up extracting working pieces out of it instead.

echoix added a commit to echoix/grass that referenced this pull request Sep 21, 2025
…SGeo#6070)

Simplified and adapted from  OSGeo#4792.
Fixes OSGeo#6066 (comment)

The action that checks for CRLF has been failing since at least this weekend.
Considering that that action has low chances of beeing fixed in a timely matter, I replaced the functionality with an .editorconfig file and validating against it with editorconfig-checker. Compared to OSGeo#4792, here I don’t attempt to make the line ending changes persist in the repo through .gitattributes, and ignore a bit more of non-ready config sections (since the functionality replaced was less detailed than what the .editorconfig I already had almost working).

I made the pre-commit run always, and made it faster in consequence to not add a big impact. With hot cache, it is taking 1min-1min10, which is about the same. I knew pre-commit could be faster in CI as I already saw how fast it was in ruff’s own CI when submitting one of my PRs there once. It can still be a bit faster, but it’s enough for today.

* CQ: Add initial .editorconfig file with basic settings

* CI: Add EditorConfig validation to super-linter workflow

* CI: Remove CRLF check from additional_checks.yml workflow

* CQ: Add editorconfig-checker to pre-commit config

* CI: Always run pre-commit in CI

* Update .editorconfig with new whitespace settings for mswindows

* CI: Run pre-commit step with uvx

* CI: Add caching for pre-commit checks in workflow

* Update .editorconfig for Windows batch files

* CI: Remove paths-filter step from additional_checks.yml

* Update additional_checks.yml step setup-uv
echoix added a commit to echoix/grass that referenced this pull request Sep 25, 2025
…SGeo#6070)

Simplified and adapted from  OSGeo#4792.
Fixes OSGeo#6066 (comment)

The action that checks for CRLF has been failing since at least this weekend.
Considering that that action has low chances of beeing fixed in a timely matter, I replaced the functionality with an .editorconfig file and validating against it with editorconfig-checker. Compared to OSGeo#4792, here I don’t attempt to make the line ending changes persist in the repo through .gitattributes, and ignore a bit more of non-ready config sections (since the functionality replaced was less detailed than what the .editorconfig I already had almost working).

I made the pre-commit run always, and made it faster in consequence to not add a big impact. With hot cache, it is taking 1min-1min10, which is about the same. I knew pre-commit could be faster in CI as I already saw how fast it was in ruff’s own CI when submitting one of my PRs there once. It can still be a bit faster, but it’s enough for today.

* CQ: Add initial .editorconfig file with basic settings

* CI: Add EditorConfig validation to super-linter workflow

* CI: Remove CRLF check from additional_checks.yml workflow

* CQ: Add editorconfig-checker to pre-commit config

* CI: Always run pre-commit in CI

* Update .editorconfig with new whitespace settings for mswindows

* CI: Run pre-commit step with uvx

* CI: Add caching for pre-commit checks in workflow

* Update .editorconfig for Windows batch files

* CI: Remove paths-filter step from additional_checks.yml

* Update additional_checks.yml step setup-uv
echoix added a commit that referenced this pull request Sep 25, 2025
…6070)

Simplified and adapted from  #4792.
Fixes #6066 (comment)

The action that checks for CRLF has been failing since at least this weekend.
Considering that that action has low chances of beeing fixed in a timely matter, I replaced the functionality with an .editorconfig file and validating against it with editorconfig-checker. Compared to #4792, here I don’t attempt to make the line ending changes persist in the repo through .gitattributes, and ignore a bit more of non-ready config sections (since the functionality replaced was less detailed than what the .editorconfig I already had almost working).

I made the pre-commit run always, and made it faster in consequence to not add a big impact. With hot cache, it is taking 1min-1min10, which is about the same. I knew pre-commit could be faster in CI as I already saw how fast it was in ruff’s own CI when submitting one of my PRs there once. It can still be a bit faster, but it’s enough for today.

* CQ: Add initial .editorconfig file with basic settings

* CI: Add EditorConfig validation to super-linter workflow

* CI: Remove CRLF check from additional_checks.yml workflow

* CQ: Add editorconfig-checker to pre-commit config

* CI: Always run pre-commit in CI

* Update .editorconfig with new whitespace settings for mswindows

* CI: Run pre-commit step with uvx

* CI: Add caching for pre-commit checks in workflow

* Update .editorconfig for Windows batch files

* CI: Remove paths-filter step from additional_checks.yml

* Update additional_checks.yml step setup-uv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous integration conflicts/needs rebase Rebase to or merge with the latest base branch is needed database Related to database management docs GUI wxGUI related HTML Related code is in HTML JavaScript Related code is in JavaScript libraries module raster3d vector Related to vector data processing windows Microsoft Windows specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants