Skip to content

Commit da3b75b

Browse files
committed
fix: separate node_modules dir per npm based formatter
without this change, using the exact same npm-based formatter (e.g. prettier) in multiple formatters, we could end up using the same directory to store their node_modules inside. This could lead - especially when using parallel builds, to a lot of issues: - overwriting each others node_modules mid-flight - overwriting package.json mid-flight - starting multiple npm-based servers on the same directory (overwriting the port-file thus leading to cross-access between formatter steps and their corresponding node server). By applying this fix, each formatter will have its own separate node_modules directory.
1 parent 0fe8f9b commit da3b75b

File tree

15 files changed

+163
-52
lines changed

15 files changed

+163
-52
lines changed

lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -68,13 +68,14 @@ public static Map<String, String> defaultDevDependenciesWithEslint(String versio
6868
return Collections.singletonMap("eslint", version);
6969
}
7070

71-
public static FormatterStep create(Map<String, String> devDependencies, Provisioner provisioner, File projectDir, File buildDir, File cacheDir, NpmPathResolver npmPathResolver, EslintConfig eslintConfig) {
71+
public static FormatterStep create(String formatName, Map<String, String> devDependencies, Provisioner provisioner, File projectDir, File buildDir, File cacheDir, NpmPathResolver npmPathResolver, EslintConfig eslintConfig) {
7272
requireNonNull(devDependencies);
7373
requireNonNull(provisioner);
7474
requireNonNull(projectDir);
7575
requireNonNull(buildDir);
76-
return FormatterStep.createLazy(NAME,
77-
() -> new State(NAME, devDependencies, projectDir, buildDir, cacheDir, npmPathResolver, eslintConfig),
76+
final String prefixedName = String.format("%s-%s", formatName, NAME);
77+
return FormatterStep.createLazy(prefixedName,
78+
() -> new State(prefixedName, devDependencies, projectDir, buildDir, cacheDir, npmPathResolver, eslintConfig),
7879
State::createFormatterFunc);
7980
}
8081

lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -69,7 +69,7 @@ public static class Runtime {
6969

7070
Runtime(NpmFormatterStepStateBase parent) {
7171
this.parent = parent;
72-
this.nodeServerLayout = new NodeServerLayout(parent.locations.buildDir(), parent.npmConfig.getPackageJsonContent());
72+
this.nodeServerLayout = new NodeServerLayout(new File(parent.locations.buildDir(), parent.stepName), parent.npmConfig.getPackageJsonContent());
7373
this.nodeServeApp = new NodeServeApp(nodeServerLayout, parent.npmConfig, parent.locations);
7474
}
7575

lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,12 +51,13 @@ public static final Map<String, String> defaultDevDependenciesWithPrettier(Strin
5151
return Collections.singletonMap("prettier", version);
5252
}
5353

54-
public static FormatterStep create(Map<String, String> devDependencies, Provisioner provisioner, File projectDir, File buildDir, File cacheDir, NpmPathResolver npmPathResolver, PrettierConfig prettierConfig) {
54+
public static FormatterStep create(String formatName, Map<String, String> devDependencies, Provisioner provisioner, File projectDir, File buildDir, File cacheDir, NpmPathResolver npmPathResolver, PrettierConfig prettierConfig) {
5555
requireNonNull(devDependencies);
5656
requireNonNull(provisioner);
5757
requireNonNull(buildDir);
58-
return FormatterStep.createLazy(NAME,
59-
() -> new State(NAME, devDependencies, projectDir, buildDir, cacheDir, npmPathResolver, prettierConfig),
58+
final String prefixedName = String.format("%s-%s", formatName, NAME);
59+
return FormatterStep.createLazy(prefixedName,
60+
() -> new State(prefixedName, devDependencies, projectDir, buildDir, cacheDir, npmPathResolver, prettierConfig),
6061
State::createFormatterFunc);
6162
}
6263

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ public PrettierConfig config(final Map<String, Object> prettierConfig) {
798798
@Override
799799
protected FormatterStep createStep() {
800800
final Project project = getProject();
801-
return PrettierFormatterStep.create(devDependencies, provisioner(), project.getProjectDir(),
801+
return PrettierFormatterStep.create(formatName(), devDependencies, provisioner(), project.getProjectDir(),
802802
project.getLayout().getBuildDirectory().getAsFile().get(), npmModulesCacheOrNull(),
803803
new NpmPathResolver(npmFileOrNull(), nodeFileOrNull(), npmrcFileOrNull(),
804804
Arrays.asList(project.getProjectDir(), project.getRootDir())),

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -106,7 +106,7 @@ public JavascriptEslintConfig(Map<String, String> devDependencies) {
106106
public FormatterStep createStep() {
107107
final Project project = getProject();
108108

109-
return EslintFormatterStep.create(devDependencies, provisioner(), project.getProjectDir(),
109+
return EslintFormatterStep.create(NAME, devDependencies, provisioner(), project.getProjectDir(),
110110
project.getLayout().getBuildDirectory().getAsFile().get(), npmModulesCacheOrNull(),
111111
new NpmPathResolver(npmFileOrNull(), nodeFileOrNull(), npmrcFileOrNull(),
112112
Arrays.asList(project.getProjectDir(), project.getRootDir())),

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -214,7 +214,7 @@ public TypescriptEslintConfig tsconfigFile(Object path) {
214214
public FormatterStep createStep() {
215215
final Project project = getProject();
216216

217-
return EslintFormatterStep.create(devDependencies, provisioner(), project.getProjectDir(),
217+
return EslintFormatterStep.create(NAME, devDependencies, provisioner(), project.getProjectDir(),
218218
project.getLayout().getBuildDirectory().getAsFile().get(), npmModulesCacheOrNull(),
219219
new NpmPathResolver(npmFileOrNull(), nodeFileOrNull(), npmrcFileOrNull(),
220220
Arrays.asList(project.getProjectDir(), project.getRootDir())),

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/PrettierIntegrationTest.java

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,10 +15,18 @@
1515
*/
1616
package com.diffplug.gradle.spotless;
1717

18+
import static org.assertj.core.api.Assertions.assertThat;
19+
20+
import java.io.File;
1821
import java.io.IOException;
22+
import java.nio.file.Files;
23+
import java.nio.file.Path;
24+
import java.util.List;
25+
import java.util.stream.Collectors;
26+
import java.util.stream.Stream;
1927

20-
import org.assertj.core.api.Assertions;
2128
import org.gradle.testkit.runner.BuildResult;
29+
import org.junit.jupiter.api.Test;
2230
import org.junit.jupiter.params.ParameterizedTest;
2331
import org.junit.jupiter.params.provider.ValueSource;
2432

@@ -51,7 +59,7 @@ void useInlineConfig(String prettierVersion) throws IOException {
5159
"}");
5260
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
5361
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
54-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
62+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
5563
switch (prettierVersion) {
5664
case PRETTIER_VERSION_2:
5765
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
@@ -81,7 +89,7 @@ void verifyCleanSpotlessCheckWorks(String prettierVersion) throws IOException {
8189
"}");
8290
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
8391
final BuildResult spotlessCheckFailsGracefully = gradleRunner().withArguments("--stacktrace", "spotlessCheck").buildAndFail();
84-
Assertions.assertThat(spotlessCheckFailsGracefully.getOutput()).contains("> The following files had format violations:");
92+
assertThat(spotlessCheckFailsGracefully.getOutput()).contains("> The following files had format violations:");
8593

8694
gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
8795
gradleRunner().withArguments("--stacktrace", "spotlessCheck").build();
@@ -104,7 +112,7 @@ void useFileConfig(String prettierVersion) throws IOException {
104112
"}");
105113
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
106114
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
107-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
115+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
108116
switch (prettierVersion) {
109117
case PRETTIER_VERSION_2:
110118
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
@@ -131,7 +139,7 @@ void chooseParserBasedOnFilename(String prettierVersion) throws IOException {
131139
"}");
132140
setFile("dirty.json").toResource("npm/prettier/filename/dirty.json");
133141
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
134-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
142+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
135143
assertFile("dirty.json").sameAsResource("npm/prettier/filename/clean.json");
136144
}
137145

@@ -169,7 +177,7 @@ void useJavaCommunityPlugin(String prettierVersion) throws IOException {
169177
"}");
170178
setFile("JavaTest.java").toResource("npm/prettier/plugins/java-test.dirty");
171179
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
172-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
180+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
173181
assertFile("JavaTest.java").sameAsResource("npm/prettier/plugins/java-test.clean");
174182
}
175183

@@ -202,7 +210,7 @@ void useJavaCommunityPluginFileConfig(String prettierVersion) throws IOException
202210
"}");
203211
setFile("JavaTest.java").toResource("npm/prettier/plugins/java-test.dirty");
204212
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
205-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
213+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
206214
assertFile("JavaTest.java").sameAsResource("npm/prettier/plugins/java-test.clean");
207215
}
208216

@@ -226,8 +234,8 @@ void suggestsMissingJavaCommunityPlugin(String prettierVersion) throws IOExcepti
226234
"}");
227235
setFile("JavaTest.java").toResource("npm/prettier/plugins/java-test.dirty");
228236
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").buildAndFail();
229-
Assertions.assertThat(spotlessApply.getOutput()).contains("Could not infer a parser");
230-
Assertions.assertThat(spotlessApply.getOutput()).contains("prettier-plugin-java");
237+
assertThat(spotlessApply.getOutput()).contains("Could not infer a parser");
238+
assertThat(spotlessApply.getOutput()).contains("prettier-plugin-java");
231239
}
232240

233241
@ParameterizedTest(name = "{index}: usePhpCommunityPlugin with prettier {0}")
@@ -264,7 +272,7 @@ void usePhpCommunityPlugin(String prettierVersion) throws IOException {
264272
"}");
265273
setFile("php-example.php").toResource("npm/prettier/plugins/php.dirty");
266274
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
267-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
275+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
268276
assertFile("php-example.php").sameAsResource("npm/prettier/plugins/php.clean");
269277
}
270278

@@ -324,9 +332,9 @@ void usePhpAndJavaCommunityPlugin(String prettierVersion) throws IOException {
324332
setFile("php-example.php").toResource("npm/prettier/plugins/php.dirty");
325333
setFile("JavaTest.java").toResource("npm/prettier/plugins/java-test.dirty");
326334
final BuildResult spotlessApply = gradleRunner().forwardOutput().withArguments("--stacktrace", "--info", "spotlessApply").build();
327-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
335+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
328336
final BuildResult spotlessApply2 = gradleRunner().forwardOutput().withArguments("--stacktrace", "--info", "spotlessApply").build();
329-
Assertions.assertThat(spotlessApply2.getOutput()).contains("BUILD SUCCESSFUL");
337+
assertThat(spotlessApply2.getOutput()).contains("BUILD SUCCESSFUL");
330338
assertFile("php-example.php").sameAsResource("npm/prettier/plugins/php.clean");
331339
assertFile("JavaTest.java").sameAsResource("npm/prettier/plugins/java-test.clean");
332340
}
@@ -355,7 +363,7 @@ void autodetectNpmrcFileConfig(String prettierVersion) throws IOException {
355363
"}");
356364
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
357365
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").buildAndFail();
358-
Assertions.assertThat(spotlessApply.getOutput()).containsPattern("Running npm command.*npm install.* failed with exit code: 1");
366+
assertThat(spotlessApply.getOutput()).containsPattern("Running npm command.*npm install.* failed with exit code: 1");
359367
}
360368

361369
@ParameterizedTest(name = "{index}: verifyCleanAndSpotlessWorks with prettier {0}")
@@ -377,9 +385,9 @@ void verifyCleanAndSpotlessWorks(String prettierVersion) throws IOException {
377385
"}");
378386
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
379387
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "clean", "spotlessApply").build();
380-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
388+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
381389
final BuildResult spotlessApply2 = gradleRunner().withArguments("--stacktrace", "clean", "spotlessApply").build();
382-
Assertions.assertThat(spotlessApply2.getOutput()).contains("BUILD SUCCESSFUL");
390+
assertThat(spotlessApply2.getOutput()).contains("BUILD SUCCESSFUL");
383391
}
384392

385393
@ParameterizedTest(name = "{index}: verifyCleanAndSpotlessWithNpmInstallCacheWorks with prettier {0}")
@@ -401,9 +409,9 @@ void verifyCleanAndSpotlessWithNpmInstallCacheWorks(String prettierVersion) thro
401409
"}");
402410
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
403411
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "clean", "spotlessApply").build();
404-
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
412+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
405413
final BuildResult spotlessApply2 = gradleRunner().withArguments("--stacktrace", "clean", "spotlessApply").build();
406-
Assertions.assertThat(spotlessApply2.getOutput()).contains("BUILD SUCCESSFUL");
414+
assertThat(spotlessApply2.getOutput()).contains("BUILD SUCCESSFUL");
407415
}
408416

409417
@ParameterizedTest(name = "{index}: autodetectNpmrcFileConfig with prettier {0}")
@@ -430,6 +438,51 @@ void pickupNpmrcFileConfig(String prettierVersion) throws IOException {
430438
"}");
431439
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
432440
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").buildAndFail();
433-
Assertions.assertThat(spotlessApply.getOutput()).containsPattern("Running npm command.*npm install.* failed with exit code: 1");
441+
assertThat(spotlessApply.getOutput()).containsPattern("Running npm command.*npm install.* failed with exit code: 1");
442+
}
443+
444+
@Test
445+
void multiplePrettierSetupsDoNotIntersectOnNpmDir() throws IOException {
446+
setFile("build.gradle").toLines(
447+
"plugins {",
448+
" id 'com.diffplug.spotless'",
449+
"}",
450+
"repositories { mavenCentral() }",
451+
"def prettierConfig = [:]",
452+
"prettierConfig['printWidth'] = 120",
453+
"spotless {",
454+
" format 'mytypescript', {",
455+
" target 'test.ts'",
456+
" prettier().config(prettierConfig)",
457+
" }",
458+
" format 'json', {",
459+
" target 'test.json'",
460+
" prettier().config(prettierConfig)",
461+
" }",
462+
" javascript {",
463+
" target 'test.js'",
464+
" prettier().config(prettierConfig)",
465+
" }",
466+
"}");
467+
468+
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
469+
setFile("test.json").toResource("npm/prettier/filetypes/json/json.dirty");
470+
setFile("test.js").toResource("npm/prettier/filetypes/javascript-es5/javascript-es5.dirty");
471+
472+
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
473+
assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
474+
475+
File buildFolder = new File(rootFolder(), "build");
476+
assertThat(buildFolder).isNotEmptyDirectory();
477+
478+
// verify it contains 3 folders containing "spotless-prettier" in it (recursively) - one for each format
479+
try (Stream<Path> pathStream = Files.walk(buildFolder.toPath())) {
480+
List<Path> nodeModulesDirs = pathStream
481+
.sorted()
482+
.filter(Files::isDirectory)
483+
.filter(path -> path.getFileName().toString().contains("spotless-prettier"))
484+
.collect(Collectors.toList());
485+
assertThat(nodeModulesDirs).hasSize(3);
486+
}
434487
}
435488
}

plugin-maven/src/main/java/com/diffplug/spotless/maven/FormatterFactory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,12 +83,12 @@ public final Set<String> excludes() {
8383
return excludes == null ? emptySet() : Sets.newHashSet(excludes);
8484
}
8585

86-
public final Formatter newFormatter(Supplier<Iterable<File>> filesToFormat, FormatterConfig config) {
86+
public final Formatter newFormatter(Supplier<Iterable<File>> filesToFormat, FormatterConfig config, int formatterIndex) {
8787
Charset formatterEncoding = encoding(config);
8888
LineEnding formatterLineEndings = lineEndings(config);
8989
LineEnding.Policy formatterLineEndingPolicy = formatterLineEndings.createPolicy(config.getFileLocator().getBaseDir(), filesToFormat);
9090

91-
FormatterStepConfig stepConfig = stepConfig(formatterEncoding, config);
91+
FormatterStepConfig stepConfig = stepConfig(formatterEncoding, config, formatterIndex);
9292
List<FormatterStepFactory> factories = gatherStepFactories(config.getGlobalStepFactories(), stepFactories);
9393

9494
List<FormatterStep> formatterSteps = factories.stream()
@@ -174,8 +174,8 @@ Optional<String> ratchetFrom(FormatterConfig config) {
174174
}
175175
}
176176

177-
private FormatterStepConfig stepConfig(Charset encoding, FormatterConfig config) {
178-
return new FormatterStepConfig(encoding, licenseHeaderDelimiter(), ratchetFrom(config), config.getProvisioner(), config.getFileLocator(), config.getSpotlessSetLicenseHeaderYearsFromGitHistory());
177+
private FormatterStepConfig stepConfig(Charset encoding, FormatterConfig config, int formatterIndex) {
178+
return new FormatterStepConfig(encoding, licenseHeaderDelimiter(), ratchetFrom(config), config.getProvisioner(), config.getFileLocator(), config.getSpotlessSetLicenseHeaderYearsFromGitHistory(), String.format("%s-%d", "formatter", formatterIndex));
179179
}
180180

181181
private static List<FormatterStepFactory> gatherStepFactories(List<FormatterStepFactory> allGlobal, List<FormatterStepFactory> allConfigured) {

plugin-maven/src/main/java/com/diffplug/spotless/maven/FormatterStepConfig.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 DiffPlug
2+
* Copyright 2016-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,14 +28,16 @@ public class FormatterStepConfig {
2828
private final Provisioner provisioner;
2929
private final FileLocator fileLocator;
3030
private final Optional<String> spotlessSetLicenseHeaderYearsFromGitHistory;
31+
private final String name;
3132

32-
public FormatterStepConfig(Charset encoding, String licenseHeaderDelimiter, Optional<String> ratchetFrom, Provisioner provisioner, FileLocator fileLocator, Optional<String> spotlessSetLicenseHeaderYearsFromGitHistory) {
33+
public FormatterStepConfig(Charset encoding, String licenseHeaderDelimiter, Optional<String> ratchetFrom, Provisioner provisioner, FileLocator fileLocator, Optional<String> spotlessSetLicenseHeaderYearsFromGitHistory, String name) {
3334
this.encoding = encoding;
3435
this.licenseHeaderDelimiter = licenseHeaderDelimiter;
3536
this.ratchetFrom = ratchetFrom;
3637
this.provisioner = provisioner;
3738
this.fileLocator = fileLocator;
3839
this.spotlessSetLicenseHeaderYearsFromGitHistory = spotlessSetLicenseHeaderYearsFromGitHistory;
40+
this.name = name;
3941
}
4042

4143
public Charset getEncoding() {
@@ -61,4 +63,8 @@ public FileLocator getFileLocator() {
6163
public Optional<String> spotlessSetLicenseHeaderYearsFromGitHistory() {
6264
return spotlessSetLicenseHeaderYearsFromGitHistory;
6365
}
66+
67+
public String getName() {
68+
return name;
69+
}
6470
}

0 commit comments

Comments
 (0)