Skip to content

Commit 9b1955b

Browse files
committed
Add missing bullet points.
1 parent 4834e22 commit 9b1955b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ Here's a checklist for creating a new step for Spotless:
103103

104104
Most formatters are going to use some kind of third-party jar. Spotless integrates with many formatters, some of which have incompatible transitive dependencies. To address this, we resolve third-party dependencies using [`JarState`](https://github.com/diffplug/spotless/blob/b26f0972b185995d7c6a7aefa726c146d24d9a82/lib/src/main/java/com/diffplug/spotless/kotlin/KtfmtStep.java#L118). To call methods on the classes in that `JarState`, you can either use reflection or a compile-only source set. See [#524](https://github.com/diffplug/spotless/issues/524) for examples of both approaches.
105105

106+
- Adding a compile-only sourceset is easier to read and probably a better approach for most cases.
107+
- Reflection is more flexible, and might be a better approach for a very simple API.
108+
106109
### Accessing the underlying File
107110

108111
In order for Spotless' model to work, each step needs to look only at the `String` input, otherwise they cannot compose. However, there are some cases where the source `File` is useful, such as to look at the file extension. In this case, you can pass a `FormatterFunc.NeedsFile` instead of a `FormatterFunc`. This should only be used in [rare circumstances](https://github.com/diffplug/spotless/pull/637), be careful that you don't accidentally depend on the bytes inside of the `File`!

0 commit comments

Comments
 (0)