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 3030import scala .collection .immutable .Set$ ;
3131
3232public class ScalafmtFormatterFunc implements FormatterFunc {
33- private final FileSignature configSignature ;
33+ private final ScalafmtConfig config ;
3434
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 {
4236 if (configSignature .files ().isEmpty ()) {
4337 // Note that reflection is used here only because Scalafmt has a method called
4438 // 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 {
5145 String configStr = new String (Files .readAllBytes (file .toPath ()), StandardCharsets .UTF_8 );
5246 config = Scalafmt .parseHoconConfig (configStr ).get ();
5347 }
48+ }
49+
50+ @ Override
51+ public String apply (String input ) {
5452 return Scalafmt .format (input , config , Set$ .MODULE$ .empty ()).get ();
5553 }
5654}
You can’t perform that action at this time.
0 commit comments