Skip to content

CMake: Pre-Commit Hook to Gersemi for auto-formatting#1722

Merged
dsnopek merged 1 commit into
godotengine:masterfrom
enetheru:gersemi
Mar 6, 2025
Merged

CMake: Pre-Commit Hook to Gersemi for auto-formatting#1722
dsnopek merged 1 commit into
godotengine:masterfrom
enetheru:gersemi

Conversation

@enetheru

Copy link
Copy Markdown
Collaborator

I found an auto formatter inspired by black.
This is what would happen if it was added to the pre-commit hooks

@dsnopek

dsnopek commented Feb 26, 2025

Copy link
Copy Markdown
Collaborator

If we're good with the code style that this enforces, I'd personally be in support this. Auto formatting makes managing changes from multiple contributors easier.

Does this PR also affect CI? Like, will builds fail if the code in the PR doesn't match the auto formatting?

@enetheru

Copy link
Copy Markdown
Collaborator Author

If we're good with the code style that this enforces, I'd personally be in support this. Auto formatting makes managing changes from multiple contributors easier.

Only larger generator expressions get mangled, but i've put in some directives to turn off the auto formatter for them.
The code style isnt to my preference, but neither is everything else.

Does this PR also affect CI? Like, will builds fail if the code in the PR doesn't match the auto formatting?

Sure does. exactly the same behaviour as existing hooks.

@enetheru
enetheru marked this pull request as ready for review March 1, 2025 01:34
@enetheru
enetheru requested review from a team as code owners March 1, 2025 01:34
@dsnopek

dsnopek commented Mar 1, 2025

Copy link
Copy Markdown
Collaborator

Looks good, but I think this should be squashed down to a single commit

@enetheru

enetheru commented Mar 1, 2025

Copy link
Copy Markdown
Collaborator Author

yup, I had them separate so you culd see the human vs gersemi changes. I'll squish now.

@dsnopek dsnopek added cmake topic:buildsystem Related to the buildsystem or CI setup cherrypick:4.4 labels Mar 4, 2025
@dsnopek dsnopek added this to the 4.x milestone Mar 4, 2025

@dsnopek dsnopek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@dsnopek
dsnopek merged commit 05f5d73 into godotengine:master Mar 6, 2025
@enetheru
enetheru deleted the gersemi branch March 6, 2025 13:03
@dsnopek

dsnopek commented Mar 17, 2025

Copy link
Copy Markdown
Collaborator

Cherry-picked for 4.4 in PR #1745

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake topic:buildsystem Related to the buildsystem or CI setup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants