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

Code Style? #12

Open
SirMoM opened this issue Oct 12, 2020 · 5 comments
Open

Code Style? #12

SirMoM opened this issue Oct 12, 2020 · 5 comments

Comments

@SirMoM
Copy link
Contributor

SirMoM commented Oct 12, 2020

I think it would be a good idea to use a code style for this project.
It would make it easier to review and contribute.

I would propose using gdscript-toolkit, which includes a linter and a code formatter to create uniform code.

What are your thoughts on this topic @akien-mga @Samuel-Lewis?

@Samuel-Lewis
Copy link
Contributor

Absolutely.

I'm a big advocate for consistency, and code style/linting is generally a big yes from me (see one of my first commits on my fork :P).

Would be cool to also add some pre-commit hooks or some GitHub code actions to enforce it across the repo as well.

@Calinou
Copy link
Member

Calinou commented Oct 12, 2020

I'd advise following the GDScript style guide 🙂

The formatter you linked can automate some of this, but parts of the style guide can't be enforced automatically yet.

@SirMoM
Copy link
Contributor Author

SirMoM commented Oct 16, 2020

So how to we go from here? What should be the result of this discussion?
Use the formatter and review the code based on the "Style Guide"?
How can we enforce the usage of the formatter?

@Calinou
Copy link
Member

Calinou commented Oct 16, 2020

Use the formatter and review the code based on the "Style Guide"?

Sure, feel free to open a pull request for that 🙂

Since modifying code style creates a large diff, you'll most likely have to rebase it to solve merge conflicts before we can merge it (since other PRs will have higher priority).

How can we enforce the usage of the formatter?

It's possible to run it in continuous integration (e.g. with GitHub Actions). I can't make a complete tutorial for this due to lack of time, but it should be feasible for anyone with some CI experience under their belt.

@akien-mga
Copy link
Member

I agree on enforcing a consistent style. The linked GDScript style guide is good.

I don't have experience with gdscript-toolkit but of its output is compatible with the style guide, that sounds good to me.

And I agree about adding it to CI via GitHub Actions. You can look at actions on the Godot repo for an example (see static checks workflow).

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

No branches or pull requests

4 participants