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

Autoformat workflow #2067

Merged
merged 5 commits into from
Aug 20, 2023
Merged

Autoformat workflow #2067

merged 5 commits into from
Aug 20, 2023

Conversation

riccardobl
Copy link
Member

A github action workflow that applies prettifier to pull requests (if needed) to automatically fix formatting issues.

Why prettifier?

  • It is standalone
  • The rules are similar to jme style but standardized (the only custom option used is tabsize=4)
  • It is supported by many editors and can be used as git pre commit hook
  • It supports many languages

The goal is to make pr integration faster by resolving all sort of formatting issues automatically, since sometimes, even with a properly configured editor it is possible to miss some. (Unless you configure your editor to format on save, but can pollute the commit since most of our code was not formatted properly from the start.).

With this workflow contributors can simply pr changes and have github action attach a formatting commit for the changed files, only if necessary.

I won't hide the fact that i am proposing this also because i am starting to believe i have developed some form of formatting blindness, since despite putting in 101% effort my PRs always have formatting issues 🦀 .

@stephengold stephengold added the buildscript An issue with the buildscript label Aug 18, 2023
@riccardobl
Copy link
Member Author

If there aren't objections i will merge this

@stephengold
Copy link
Member

Go ahead and integrate it. If it causes problems, we can simply delete the workflow, right?

@stephengold stephengold added this to the Future Release milestone Aug 19, 2023
@Ali-RS
Copy link
Member

Ali-RS commented Aug 19, 2023

Shall we test this in a separate branch with a dummy PR first? Just to see if it works fine before applying it on real PRs.

@riccardobl
Copy link
Member Author

riccardobl commented Aug 19, 2023

Go ahead and integrate it. If it causes problems, we can simply delete the workflow, right?

Yes

Shall we test this in a separate branch with a dummy PR first? Just to see if it works fine before applying it on real PRs.

I've tested it here https://github.com/RiccardoblSandbox/jmonkeyengine-test .
I increased the suggested line length to 180 (that's the same max line length of our jme_style.xml) because it was breaking the lines too easily

@Ali-RS
Copy link
Member

Ali-RS commented Aug 19, 2023

Do we prefer this

    public BulletAppState(
        Vector3f worldMin,
        Vector3f worldMax,
        BroadphaseType broadphaseType
    ) {

over this?

public BulletAppState(Vector3f worldMin, Vector3f worldMax, BroadphaseType broadphaseType) {

or was that because of the line length setting you mentioned above?

@stephengold
Copy link
Member

I think the maximum line length should be 110 characters/columns, per our preferred coding style: https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/CONTRIBUTING.md#coding-style

@riccardobl
Copy link
Member Author

or was that because of the line length setting you mentioned above?

This is the formatting with line width = 110

RiccardoblSandbox@65454e2

I think the maximum line length should be 110 characters/columns, per our preferred coding style: https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/CONTRIBUTING.md#coding-style

Done, it seems JME_style.xml has some errors

@Ali-RS
Copy link
Member

Ali-RS commented Aug 20, 2023

This is the formatting with line width = 110
RiccardoblSandbox@65454e2

I think it looks better now, thanks.

What was the default width used by the plugin?

@riccardobl
Copy link
Member Author

This is the formatting with line width = 110
RiccardoblSandbox@65454e2

I think it looks better now, thanks.

What was the default width used by the plugin?

it uses 80

@riccardobl riccardobl merged commit 44ee07a into master Aug 20, 2023
15 checks passed
@stephengold
Copy link
Member

Is there any reason to retain the "autoformat" branch in the public repo?

@riccardobl riccardobl deleted the autoformat branch October 14, 2023 20:47
@riccardobl
Copy link
Member Author

nope, removed.

@stephengold
Copy link
Member

This feature was disabled at 7c20f95 (12 October 2023).

@stephengold stephengold removed this from the Future Release milestone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildscript An issue with the buildscript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants