smithy-lang / smithy

Smithy is a protocol-agnostic interface definition language and set of tools for generating clients, servers, and documentation for any programming language.
https://smithy.io
Apache License 2.0
1.77k stars 208 forks source link

Add option to fail the build on formatting violations #2317

Open RenFraser opened 3 months ago

RenFraser commented 3 months ago

Hi folks, thanks for the great work on Smithy.

Is there an option to fail the Gradle build on formatting violations? It would be great to be able to be able to set options for the smithyFormat task to fail on violations, if not already an option to do so.

If this isn't an option, is it on the roadmap, or is there existing information that would make implementing it via a PR easier, if this is aligned with the maintainers' vision?

JordonPhillips commented 3 months ago

Do you mean failing if the formatter would apply changes? For example, like black --check for python?

RenFraser commented 3 months ago

Yeah, that's right. I'm not familiar with the black formatter sorry, though I have heard of it. The idea is that instead of formatting on build, it would instead check the formatting of smithy fails and fail the build. That way, formatting could be enforced when the pipeline Gradle build command is run.