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

Better / Consistent Formatting #43

Open
baldawar opened this issue Sep 12, 2022 · 2 comments
Open

Better / Consistent Formatting #43

baldawar opened this issue Sep 12, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@baldawar
Copy link
Collaborator

What is your idea?

Add some means to have consistent formatting across the codebase. See comment https://github.com/aws/event-ruler/pull/39/files#r967886681 for some early thoughts.

Would you be willing to make the change?

Maybe

@baldawar
Copy link
Collaborator Author

I looked into this a bit more while reviewing #60. Seems there's a bunch of options listed within https://github.com/google/google-java-format. Love the idea of a github actions so that we don't have to talk about formatting during reviews.

There's also https://github.com/revelc/formatter-maven-plugin.

All of these are tools I'm not too familiar with, so more deep dive is required on if there's any gotchas or regressions that such tools can introduce.

@schenksj
Copy link
Contributor

schenksj commented Jan 29, 2023

Might not be a terrible idea to add husky (https://github.com/typicode/husky) hooks into the repo to assure that code has been formatted, along with a 1-time reformat PR for the selected formatter. Only real downside is that husky will required you to install node/npm on any machine used for development.

My teams at my day job have had great success with enforcing this in python with black, pylint, and pycov (and for golang go test -cover, go fmt, and golangci-lint). I believe similar open source tools exist for java as well. Personally, I've had great luck with google-java-format just using the default configuration. It is wonderful how (whether you like how the resulting code looks or not), there is a single correct answer to things that "sort-of" matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants