-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add a task which checks for format compliance #9
Comments
I agree it would make sense (the format is actually not executed by default in our build to avoid this kind of problems with commit changes). I did not get your point about @Formatter tags, would you mind to explain it into more details please? |
If you have a block of code with weird spacing that violates your format, but you'd like to preserve it (maybe as ASCII art comment), you can add Personally, I always make a commit before I run the formatter. Then I run the formatter, and look at the diff. If there's a piece I don't like, I restore that part and wrap it in formatter tags. I think the biggest usage of the The most common format enforcer people are using these days is Your plugin is great for contributors because they can fix violations automatically, but it's pain for library maintainers because there isn't an easy way to check for compliance. With this feature, I think your plugin would be the undeniable best option. |
The
format
task applies the format, which is great.It would be awesome if there was a
checkFormat
task, which was added as a dependency to thecheck
task, but only threw errors / warnings without actually applying those changes.The license-gradle-plugin works this way. If you want to tinker with it on a super-simple example project, it is used here.
This makes it easy for someone to see that they have a formatting problem when they run
gradlew build
, and gives them a chance to commit their changes before running theformat
, which might make changes they'd like to disable with a pair of@formatter:off/on
tags.I think this could be achieved by looking at the value of the TextEdit which is generated by the formatter.
The text was updated successfully, but these errors were encountered: