-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Introduce quarkus format
(or quarkus fmt
)
#30337
Comments
if quarkus format just calls underlying build tools format operation I don't see much value in it. it should be something that formats code in a consistent way no matter the underlying build tool imo. |
Most of the time formatting is specific to company. Companies creates their custom formatting rules, this may not add much value and if Quarkus is going to add it then it should be configurable. |
That's precisely why I suggested invoking the formatter plugin instead |
I think it needs to be consistent rules, to make sure everyone in a team gets the exact same stuff, without argument and with no option for configuration. In formatting, customisation is what causes pain. So invoking the formatter plugin would have a risk that someone customised it. Our rules seem like good rules to assume. And then we need to make sure the IDE's formatter agrees with our view of the world, so that the IDE and CLI aren't fighting. That on its own would be worth the price of admission, actually, even if didn't do anything else. I keep tripping over that on projects - most recently I was getting release failures because of formatting mismatches between IDE and CLI. |
In particular, "It is an intentional design choice that there are no configuration options for gofmt. The benefit of eliminating bike shed discussion about formatting choices is considered to be more important than the cost of not permitting people to use their preferred style. The usual saying is that gofmt isn't anybody's preferred style, but it's adequate for everybody." |
... and if companies feel the position of braces justifies the cost of arguing about formatting rules, they can always not use the quarkus fmt command. The differentiator of this command would have to be that it's massively opinionated, because formatting code on its own is definitely not novel :) No one needs the cognitive load of another tool to remember, if it behaves exactly like the many tools already out there. |
@holly-cummins that makes sense. I'll prototype something and see how that works out |
jbang aliases from the Quarkus catalog are already supported as CLI plugins, so I am going to close this. |
Description
Analogous to
go fmt
, it would be nice if the CLI had a command to automatically format the project sources by runningquarkus fmt
Implementation ideas
The command may invoke the
mvn formatter:format
goal (if configured in the project) otherwise prompt to include it in the project and use the Quarkus IDE Config (io.quarkus:quarkus-ide-config
) by defaultThe text was updated successfully, but these errors were encountered: