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

Using meson format to help with consistency #40

Open
andy5995 opened this issue Dec 4, 2024 · 5 comments
Open

Using meson format to help with consistency #40

andy5995 opened this issue Dec 4, 2024 · 5 comments
Assignees
Labels
CI enhancement New feature or request help wanted Extra attention is needed tracker

Comments

@andy5995
Copy link
Contributor

andy5995 commented Dec 4, 2024

meson format is a thing now. https://mesonbuild.com/Commands.html#format

I'm going to open a PR to add an .editorconfig file which can be used for that. I think it will help maintain consistency. I can spend less time trying to make sure my formatting is correct when working on meson here.

Sound good?

@KaruroChori
Copy link
Owner

KaruroChori commented Dec 4, 2024

TLDR: For now consistency in formatting is not too important, feel free to write code more or less as it comes with your current configuration :).

As a follow up of the conversation we had earlier, I think .editorconfig is too simplistic and cannot fully cover the needs of the project as a whole.
You suggested using it just to format meson alone, but even in that case a proper meson.format has many more options needed to fully describe the normal form for such files.
This would quickly became unmanageable if we consider the complexity of clang-format and its customization, or how many options something like biome has.

This repo, at this point in time, is handling: c, cpp, swift, markdwon, xml, ts, json, yaml, meson & possibly more. Structuring a process to ensure consistency on every major editor for all these languages, and expecting a contributor to have all the equivalent extensions installed is not really an option.

As I suggested, prettification should be part of the CI, and condition for a merge to be possible. If failing, a bot should apply any normalization automatically, and submit it as PR.

This also means that developers should not really care to match the prior "style" being used all that much. At some point, a robot will (hopefully) be handling that on our behalf.

@KaruroChori KaruroChori added enhancement New feature or request help wanted Extra attention is needed tracker CI labels Dec 4, 2024
@KaruroChori KaruroChori self-assigned this Dec 4, 2024
@andy5995
Copy link
Contributor Author

andy5995 commented Dec 5, 2024

That should make things easier in the long run.

@KaruroChori
Copy link
Owner

KaruroChori pushed a commit that referenced this issue Dec 5, 2024
@andy5995
Copy link
Contributor Author

andy5995 commented Dec 6, 2024

https://github.com/widelands/widelands/blob/8c67fb9d353da20eb6058ba96b628ffa52af135b/utils/run-clang-tidy.py

https://github.com/widelands/widelands/blob/8c67fb9d353da20eb6058ba96b628ffa52af135b/.github/workflows/build_clang_tidy.yaml

This one is simpler; it just fails the PR if the code-formatting is incorrect:
https://github.com/netpanzer/netpanzer/blob/ad1c9ab927c5f9644b443fbba91e1c468c4b595d/.github/workflows/check-formatting.yml I'll leave it as a reference even though it's not exactly what you want at this time.

@KaruroChori
Copy link
Owner

For reference: https://github.com/super-linter/super-linter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI enhancement New feature or request help wanted Extra attention is needed tracker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants