Skip to content

Commit 6c480d8

Browse files
committed
Add info to CONTRIBUTING
1 parent a9bd0a6 commit 6c480d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Here's a checklist for creating a new step for Spotless:
9393
- [ ] Class name ends in Step, `SomeNewStep`.
9494
- [ ] Class has a public static method named `create` that returns a `FormatterStep`.
9595
- [ ] Has a test class named `SomeNewStepTest` that uses `StepHarness` or `StepHarnessWithFile` to test the step.
96-
- [ ] Start with `StepHarness.forStep(myStep).supportsRoundTrip(false)`, and then add round trip support as described in the next section.
9796
- [ ] Test class has test methods to verify behavior.
9897
- [ ] Test class has a test method `equality()` which tests equality using `StepEqualityTester` (see existing methods for examples).
9998

@@ -137,6 +136,15 @@ There are many great formatters (prettier, clang-format, black, etc.) which live
137136

138137
Because of Spotless' up-to-date checking and [git ratcheting](https://github.com/diffplug/spotless/tree/main/plugin-gradle#ratchet), Spotless actually doesn't have to call formatters very often, so even an expensive shell call for every single invocation isn't that bad. Anything that works is better than nothing, and we can always speed things up later if it feels too slow (but it probably won't).
139138

139+
## Lints
140+
141+
Spotless is primarily a formatter, not a linter. But, if something goes wrong during formatting, it's better to model that as a lint with line numbers rather than just a naked exception. There are two ways to go about this:
142+
143+
- at any point during the formatting process, you can throw a `Lint.atLine(int line, ...)` exception. This will be caught and turned into a lint.
144+
- or you can override the `default List<Lint> lint(String content, File file)` method. This method will only run if the step did not already throw an exception.
145+
146+
Don't go lint crazy! By default, all lints are build failures. Users have to suppress them explicitly if they want to continue.
147+
140148
## How to add a new plugin for a build system
141149

142150
The gist of it is that you will have to:

0 commit comments

Comments
 (0)