File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
lib/src/scalafmt/java/com/diffplug/spotless/glue/scalafmt Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 30
30
import scala .collection .immutable .Set$ ;
31
31
32
32
public class ScalafmtFormatterFunc implements FormatterFunc {
33
- private final FileSignature configSignature ;
33
+ private final ScalafmtConfig config ;
34
34
35
- public ScalafmtFormatterFunc (FileSignature configSignature ) {
36
- this .configSignature = configSignature ;
37
- }
38
-
39
- @ Override
40
- public String apply (String input ) throws Exception {
41
- ScalafmtConfig config ;
35
+ public ScalafmtFormatterFunc (FileSignature configSignature ) throws Exception {
42
36
if (configSignature .files ().isEmpty ()) {
43
37
// Note that reflection is used here only because Scalafmt has a method called
44
38
// default which happens to be a reserved Java keyword. The only way to call
@@ -51,6 +45,10 @@ public String apply(String input) throws Exception {
51
45
String configStr = new String (Files .readAllBytes (file .toPath ()), StandardCharsets .UTF_8 );
52
46
config = Scalafmt .parseHoconConfig (configStr ).get ();
53
47
}
48
+ }
49
+
50
+ @ Override
51
+ public String apply (String input ) {
54
52
return Scalafmt .format (input , config , Set$ .MODULE$ .empty ()).get ();
55
53
}
56
54
}
You can’t perform that action at this time.
0 commit comments