Skip to content

Commit 12eea16

Browse files
authored
Merge pull request #458 from diffplug/feature/bump-scalafmt-default
Feature/bump scalafmt default
2 parents a7c74de + 009c93a commit 12eea16

File tree

13 files changed

+61
-13
lines changed

13 files changed

+61
-13
lines changed

Diff for: CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ You might be looking for:
1818
- combined with up-to-date checking, could lead to even more confusing results (https://github.com/diffplug/spotless/issues/338)
1919
- only affects the gradle plugin, since that was the only plugin to use this feature
2020
* Minor change to `TestProvisioner`, which should fix the cache-breaking issues, allowing us to speed-up the CI builds a bit.
21+
* Bumped `scalafmt` default version from `1.1.0` to `2.0.1`, since there are [bugs](https://github.com/diffplug/spotless/issues/454) in the old default ([#458](https://github.com/diffplug/spotless/pull/458)).
2122

2223
### Version 1.24.1 - August 12th 2018 (javadoc [lib](https://diffplug.github.io/spotless/javadoc/spotless-lib/1.24.1/) [lib-extra](https://diffplug.github.io/spotless/javadoc/spotless-lib-extra/1.24.1/), artifact [lib]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib), [lib-extra]([jcenter](https://bintray.com/diffplug/opensource/spotless-lib-extra)))
2324

Diff for: lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ScalaFmtStep {
4040
private ScalaFmtStep() {}
4141

4242
private static final Pattern VERSION_PRE_2_0 = Pattern.compile("[10]\\.(\\d+)\\.\\d+");
43-
private static final String DEFAULT_VERSION = "1.1.0";
43+
private static final String DEFAULT_VERSION = "2.0.1";
4444
static final String NAME = "scalafmt";
4545
static final String MAVEN_COORDINATE_PRE_2_0 = "com.geirsson:scalafmt-core_2.11:";
4646
static final String MAVEN_COORDINATE = "org.scalameta:scalafmt-core_2.11:";

Diff for: plugin-gradle/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
([#338](https://github.com/diffplug/spotless/issues/338))
1515
- Fixed now!
1616
* When you specify `targetExclude()`, spotless no longer silently removes `build` directories from the exclusion ([#457](https://github.com/diffplug/spotless/pull/457)).
17+
* Bumped `scalafmt` default version from `1.1.0` to `2.0.1`, since there are [bugs](https://github.com/diffplug/spotless/issues/454) in the old default ([#458](https://github.com/diffplug/spotless/pull/458)).
1718

1819
### Version 3.24.2 - August 19th 2019 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-plugin-gradle/3.24.1/), [jcenter](https://bintray.com/diffplug/opensource/spotless-plugin-gradle/3.24.1))
1920

Diff for: plugin-gradle/src/test/java/com/diffplug/gradle/spotless/ScalaExtensionTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public void integration() throws IOException {
3636
setFile("scalafmt.conf").toResource("scala/scalafmt/scalafmt.conf");
3737
setFile("src/main/scala/basic.scala").toResource("scala/scalafmt/basic.dirty");
3838
gradleRunner().withArguments("spotlessApply").build();
39-
assertFile("src/main/scala/basic.scala").sameAsResource("scala/scalafmt/basic.cleanWithCustomConf");
39+
assertFile("src/main/scala/basic.scala").sameAsResource("scala/scalafmt/basic.cleanWithCustomConf_2.0.1");
4040
}
4141
}

Diff for: plugin-maven/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Fixes [#410](https://github.com/diffplug/spotless/issues/410) AccessDeniedException in MinGW/ GitBash.
77
* Also fixes occasional [hang on NFS due to filesystem timers](https://github.com/diffplug/spotless/pull/407#issuecomment-514824364).
88
* Eclipse-based formatters used to leave temporary files around ([#447](https://github.com/diffplug/spotless/issues/447)). This is now fixed, but only for eclipse 4.12+, no back-port to older Eclipse formatter versions is planned. ([#451](https://github.com/diffplug/spotless/issues/451))
9+
* Bumped `scalafmt` default version from `1.1.0` to `2.0.1`, since there are [bugs](https://github.com/diffplug/spotless/issues/454) in the old default ([#458](https://github.com/diffplug/spotless/pull/458)).
910

1011
### Version 1.24.1 - August 12th 2019 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-maven-plugin/1.24.1/), [jcenter](https://bintray.com/diffplug/opensource/spotless-maven-plugin/1.24.1))
1112

Diff for: plugin-maven/src/test/java/com/diffplug/spotless/maven/IncludesExcludesTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class IncludesExcludesTest extends MavenIntegrationTest {
2424
private static final String JAVA_FORMATTED = "java/eclipse/JavaCodeFormatted.test";
2525
private static final String JAVA_UNFORMATTED = "java/eclipse/JavaCodeUnformatted.test";
2626
private static final String SCALA_UNFORMATTED = "scala/scalafmt/basic.dirty";
27-
private static final String SCALA_FORMATTED = "scala/scalafmt/basic.clean";
27+
private static final String SCALA_FORMATTED = "scala/scalafmt/basic.clean_2.0.1";
2828

2929
@Test
3030
public void testDefaultIncludesJava() throws Exception {

Diff for: plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void testConfigurationDependency() throws Exception {
9393
assertFile("two/src/main/java/test1.java").sameAsResource("java/eclipse/JavaCodeFormatted.test");
9494
assertFile("two/src/test/java/test2.java").sameAsResource("java/eclipse/JavaCodeFormatted.test");
9595

96-
assertFile("three/src/main/scala/test1.scala").sameAsResource("scala/scalafmt/basic.cleanWithCustomConf");
97-
assertFile("three/src/test/scala/test2.scala").sameAsResource("scala/scalafmt/basic.cleanWithCustomConf");
96+
assertFile("three/src/main/scala/test1.scala").sameAsResource("scala/scalafmt/basic.cleanWithCustomConf_2.0.1");
97+
assertFile("three/src/test/scala/test2.scala").sameAsResource("scala/scalafmt/basic.cleanWithCustomConf_2.0.1");
9898
}
9999
}

Diff for: plugin-maven/src/test/java/com/diffplug/spotless/maven/scala/ScalafmtTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ScalafmtTest extends MavenIntegrationTest {
2424
public void testScalafmtWithDefaultConfig() throws Exception {
2525
writePomWithScalaSteps("<scalafmt/>");
2626

27-
runTest("scala/scalafmt/basic.clean");
27+
runTest("scala/scalafmt/basic.clean_2.0.1");
2828
}
2929

3030
@Test
@@ -36,7 +36,7 @@ public void testScalafmtWithCustomConfig() throws Exception {
3636
" <file>${project.basedir}/scalafmt.conf</file>",
3737
"</scalafmt>");
3838

39-
runTest("scala/scalafmt/basic.cleanWithCustomConf");
39+
runTest("scala/scalafmt/basic.cleanWithCustomConf_2.0.1");
4040
}
4141

4242
private void runTest(String s) throws Exception {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@foobar("annot", {
2+
val x = 2
3+
val y = 2 // y=2
4+
x + y
5+
})
6+
object a
7+
extends b
8+
with c {
9+
def foo[
10+
T: Int#Double#Triple,
11+
R <% String
12+
](
13+
@annot1
14+
x: Int @annot2 =
15+
2,
16+
y: Int = 3
17+
): Int = {
18+
"match" match {
19+
case 1 | 2 =>
20+
3
21+
case <A>2</A> =>
22+
2
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@foobar("annot", {
2+
val x = 2
3+
val y = 2 // y=2
4+
x + y
5+
})
6+
object a extends b with c {
7+
def foo[T: Int#Double#Triple, R <% String](
8+
@annot1
9+
x: Int @annot2 = 2,
10+
y: Int = 3
11+
): Int = {
12+
"match" match {
13+
case 1 | 2 =>
14+
3
15+
case <A>2</A> => 2
16+
}
17+
}
18+
}

Diff for: testlib/src/test/java/com/diffplug/spotless/scala/ScalaFmtStepTest.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@
2929
public class ScalaFmtStepTest extends ResourceHarness {
3030
@Test
3131
public void behaviorDefaultConfig() throws Exception {
32-
FormatterStep step = ScalaFmtStep.create(TestProvisioner.mavenCentral());
33-
StepHarness.forStep(step)
34-
.testResource("scala/scalafmt/basic.dirty", "scala/scalafmt/basic.clean");
32+
StepHarness.forStep(ScalaFmtStep.create("1.1.0", TestProvisioner.mavenCentral(), null))
33+
.testResource("scala/scalafmt/basic.dirty", "scala/scalafmt/basic.clean_1.1.0");
34+
StepHarness.forStep(ScalaFmtStep.create("2.0.1", TestProvisioner.mavenCentral(), null))
35+
.testResource("scala/scalafmt/basic.dirty", "scala/scalafmt/basic.clean_2.0.1");
3536
}
3637

3738
@Test
3839
public void behaviorCustomConfig() throws Exception {
39-
FormatterStep step = ScalaFmtStep.create(ScalaFmtStep.defaultVersion(), TestProvisioner.mavenCentral(), createTestFile("scala/scalafmt/scalafmt.conf"));
40-
StepHarness.forStep(step)
41-
.testResource("scala/scalafmt/basic.dirty", "scala/scalafmt/basic.cleanWithCustomConf");
40+
StepHarness.forStep(ScalaFmtStep.create("1.1.0", TestProvisioner.mavenCentral(), createTestFile("scala/scalafmt/scalafmt.conf")))
41+
.testResource("scala/scalafmt/basic.dirty", "scala/scalafmt/basic.cleanWithCustomConf_1.1.0");
42+
StepHarness.forStep(ScalaFmtStep.create("2.0.1", TestProvisioner.mavenCentral(), createTestFile("scala/scalafmt/scalafmt.conf")))
43+
.testResource("scala/scalafmt/basic.dirty", "scala/scalafmt/basic.cleanWithCustomConf_2.0.1");
4244
}
4345

4446
@Test

0 commit comments

Comments
 (0)