Comments (8)
as a matter of fact you are totally right both in "when the task is called" and in the statement that spotless is much faster ;-)
from spotless.
If you'd like to remove spotlessCheck
from the check
task, this will do it:
afterEvaluate {
tasks.getByName('check').dependsOn.remove(tasks.getByName('spotlessCheck'))
}
We're going to keep the default behavior of adding spotlessCheck
to check
automatically. A positive value in the gradle ecosystem is "convention over configuration" - when you add unit tests, style checkers, static analysis tools, they all hook into check
by default, so that you don't have to do the plumbing yourself. Perfectly valid that you'd like to use it a different way though :)
from spotless.
Thanks for the workaround, good enough for our case. 👍
Maybe adding this to the Readme.md would help other people too.
from spotless.
Maybe adding this to the Readme.md would help other people too.
It's a good question, and GitHub's issue search is very good. Hopefully others who have this same issue will find this question.
I try to make the readme describe the project as concisely as possible. I believe this use case is a less <10% case, and thus doesn't earn a spot. As evidence, if your use case was more common, then every stylechecker / static analyzer / unit test runner in the gradle ecosystem should have this in their readme.
from spotless.
Also, out of curiosity, why do you not want spotlessCheck
to run on every call to check
?
from spotless.
We like to separate concerns in the build on CI
e.g. compiling/packaging
<-> running unit tests
<-> running integration tests
<-> auditing code
.
Also, we like to keep the build as fast as possible during development to achieve small turnaround times.
from spotless.
Here's gradle's task dependency graph:
If you'd like to just compile and package, run assemble
. If you just want to run tests, run test
(or integTest
if you've made a separate unit test task).
The objective of the check
task is (according to the gradle docs):
All verification tasks in the project, including test. Some plugins add additional verification tasks to the project.
You can use Gradle however you'd like, but it sounds like you're swimming upstream :) If you want people to always be able to run gradle build
and have it be fast, I'd recommend that you instead print out the task graph above and leave it on their desk, and then they'll know which tasks to run for themselves, depending on how fast they'd like their result.
Also, spotless is much faster than a reasonable unit test suite :)
from spotless.
For anyone else stumbling upon this from Google: this has been added in the meantime.
To remove spotlessCheck
as a dependency to check
when using the gradle plugin, add
spotless {
isEnforceCheck = false
}
See the plugin-gradle/README.md
from spotless.
Related Issues (20)
- OutOfMemoryError due to LineEndingsPolicy in JvmLocalCache HOT 2
- Sortpom should fail instead of silently sort on spotless:check HOT 2
- targetExcludeFilename
- multi configuration same language
- Maven: Inconsistent formatting of Java (google AOSP style) with plugin and google-java-format.jar
- Failed to create Jar file groovy-2.9.98-SNAPSHOT.jar
- Sorting properties files HOT 1
- Add Gradle support for Maven POM sorting/formatting
- Can Spotless be configured to use e.g. "GoogleJavaFormat 1.21.0 or newer"?
- Missing required bundle org.eclipse.jdt.debug needed by [org.eclipse.jdt.launching] - spotless version 6.25.0
- Java license header not reformatted for `package-info.java` files HOT 1
- Spotless's `spotlessSetLicenseHeaderYearsFromGitHistory`: Unable to parse date from command
- gradle: excluding spotlessJava should also exclude spotlessApply
- Maven plugin readme: CTRL + click
- Maven plugin has no `endWithNewLine` option
- Add Eclipse P2 repository customizable keystore/truststore configuration
- How to suppress a custom rule for a function HOT 7
- could not resolve plugin artifact 'com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:6.25.0') Searched in the following repositories maven(https://plugins.gradle.org/m2/) HOT 1
- imports broken by whitespace over at least two lines cannot be parsed HOT 1
- improve error message for npm-based formatters to emphasize local-only HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spotless.