Skip to content

Commit 9ec6f63

Browse files
committed
Add comments for what the differences are in each version of the adapter function.
1 parent 3dfb10e commit 9ec6f63

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,23 @@ public class KtlintFormatterFunc implements FormatterFunc.NeedsFile {
4141
public KtlintFormatterFunc(String version, boolean isScript, boolean useExperimental, Map<String, String> userData,
4242
Map<String, Object> editorConfigOverrideMap) {
4343
int minorVersion = Integer.parseInt(version.split("\\.")[1]);
44-
if (version.equals("0.45.2")) {
45-
this.adapter = new KtLintCompat0Dot45Dot2Adapter();
46-
} else if (minorVersion >= 47) {
44+
if (minorVersion >= 47) {
45+
// rename RuleSet to RuleProvider
4746
this.adapter = new KtLintCompat0Dot47Dot0Adapter();
4847
} else if (minorVersion >= 46) {
48+
// DefaultEditorConfigProperties.INSTANCE.getDefaultEditorConfigProperties() renamed to .getEditorConfigProperties()
4949
this.adapter = new KtLintCompat0Dot46Dot0Adapter();
50+
} else if (version.equals("0.45.2")) {
51+
// add editorConfigOverride
52+
this.adapter = new KtLintCompat0Dot45Dot2Adapter();
5053
} else if (minorVersion >= 34) {
54+
// KtLint.INSTANCE.format() now needs more parameters
5155
this.adapter = new KtLintCompat0Dot34Dot2Adapter();
5256
} else if (minorVersion >= 32) {
57+
// rename packages from `com.github.shyiko` to `com.pinterest`
5358
this.adapter = new KtLintCompat0Dot32Dot0Adapter();
5459
} else {
60+
// the OG
5561
this.adapter = new KtLintCompat0Dot31Dot0Adapter();
5662
}
5763
this.useExperimental = useExperimental;

0 commit comments

Comments
 (0)