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

Task formatKotlin should not fail build if it can fix problems #335

Open
strindberg opened this issue Jul 9, 2023 · 2 comments
Open

Task formatKotlin should not fail build if it can fix problems #335

strindberg opened this issue Jul 9, 2023 · 2 comments

Comments

@strindberg
Copy link

When running gradle formatKotlin, the build fails if any issues are found. However, I think it would be better if the task would not fail if the formatter could fix the problems it finds: after all, after the successful formatting the code is actually fixed.

@jeremymailen
Copy link
Owner

Good point, although when format did something the workspace is dirty and some CI flow might need to detect that with a distinct exit result. We have ignoreFailures to handle continuing a build after lint failure. Perhaps a similar param to control this? Can you elaborate on the workflow this is needed for?

@strindberg
Copy link
Author

I would find this particularly useful for interactive use. Our projects take a couple of minutes to build, and I cannot count the number of times I have started a build with gradle build, expecting it to take a while to finish (particularly if a test has run green in the IDE), only to check back a little later to find that it failed on the linting task.

I thought I would remedy this with an alias: alias build='gradle formatKotlin buildso that the formatting is always run before the build task. Of course I still expect the build to fail if the formatter cannot fix the problem, or if there is some other build issue. But it would be useful if gradle formatKotlin build would succeed if the formatter was able to fix any lint issues.

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

No branches or pull requests

2 participants