diff --git a/gradle/rewrite.gradle b/gradle/rewrite.gradle index 9f75f75e96..11f476b0f7 100644 --- a/gradle/rewrite.gradle +++ b/gradle/rewrite.gradle @@ -2,9 +2,13 @@ apply plugin: 'org.openrewrite.rewrite' rewrite { activeRecipe('com.diffplug.spotless.openrewrite.SanityCheck') + activeStyle('com.diffplug.spotless.openrewrite.SpotlessFormat') exclusions.addAll( '**.dirty.java', + '**DiffMessageFormatterTest.java', + '**EclipseJdtSortMembers.java', '**FormatterProperties.java', + '**PaddedCellTaskTest.java', '**_gradle_node_plugin_example_**', '**gradle/changelog.gradle', '**gradle/java-publish.gradle', diff --git a/lib/src/compatDiktat1Dot2Dot5/java/com/diffplug/spotless/glue/diktat/compat/DiktatCompat1Dot2Dot5Adapter.java b/lib/src/compatDiktat1Dot2Dot5/java/com/diffplug/spotless/glue/diktat/compat/DiktatCompat1Dot2Dot5Adapter.java index ff27e96d47..ffd42ecedb 100644 --- a/lib/src/compatDiktat1Dot2Dot5/java/com/diffplug/spotless/glue/diktat/compat/DiktatCompat1Dot2Dot5Adapter.java +++ b/lib/src/compatDiktat1Dot2Dot5/java/com/diffplug/spotless/glue/diktat/compat/DiktatCompat1Dot2Dot5Adapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 DiffPlug + * Copyright 2023-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ static class FormatterCallback implements Function2 { } @Override - public Unit invoke(LintError lintError, Boolean corrected) { + public @Nullable Unit invoke(LintError lintError, Boolean corrected) { if (!corrected) { errors.add(lintError); } diff --git a/lib/src/main/java/com/diffplug/spotless/Jvm.java b/lib/src/main/java/com/diffplug/spotless/Jvm.java index 7d8812546b..6ea35eb535 100644 --- a/lib/src/main/java/com/diffplug/spotless/Jvm.java +++ b/lib/src/main/java/com/diffplug/spotless/Jvm.java @@ -120,12 +120,12 @@ private void verifyVersionRangesDoNotIntersect(NavigableMap jvm2fmtV } /** @return Highest formatter version recommended for this JVM (null, if JVM not supported) */ - @Nullable public V getRecommendedFormatterVersion() { + public @Nullable V getRecommendedFormatterVersion() { Integer configuredJvmVersionOrNull = jvm2fmtMaxVersion.floorKey(Jvm.version()); return configuredJvmVersionOrNull == null ? null : jvm2fmtMaxVersion.get(configuredJvmVersionOrNull); } - @Nullable public V getMinimumRequiredFormatterVersion() { + public @Nullable V getMinimumRequiredFormatterVersion() { Integer configuredJvmVersionOrNull = jvm2fmtMinVersion.floorKey(Jvm.version()); return configuredJvmVersionOrNull == null ? null : jvm2fmtMinVersion.get(configuredJvmVersionOrNull); } diff --git a/lib/src/main/java/com/diffplug/spotless/PaddedCell.java b/lib/src/main/java/com/diffplug/spotless/PaddedCell.java index 5ec7ef1cad..18fb44acbb 100644 --- a/lib/src/main/java/com/diffplug/spotless/PaddedCell.java +++ b/lib/src/main/java/com/diffplug/spotless/PaddedCell.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,12 +105,12 @@ private static PaddedCell check(Formatter formatter, File file, String original, } String appliedOnce = formatter.computeWithLint(original, file, exceptionPerStep); if (appliedOnce.equals(original)) { - return Type.CONVERGE.create(file, Collections.singletonList(appliedOnce)); + return Type.CONVERGE.create(file, List.of(appliedOnce)); } String appliedTwice = formatter.computeWithLint(appliedOnce, file, exceptionPerStep); if (appliedOnce.equals(appliedTwice)) { - return Type.CONVERGE.create(file, Collections.singletonList(appliedOnce)); + return Type.CONVERGE.create(file, List.of(appliedOnce)); } List appliedN = new ArrayList<>(); diff --git a/lib/src/main/java/com/diffplug/spotless/ValuePerStep.java b/lib/src/main/java/com/diffplug/spotless/ValuePerStep.java index 094edbb765..51fcae36b5 100644 --- a/lib/src/main/java/com/diffplug/spotless/ValuePerStep.java +++ b/lib/src/main/java/com/diffplug/spotless/ValuePerStep.java @@ -61,7 +61,7 @@ class ValuePerStep extends AbstractList { } @Override - public T get(int index) { + public @Nullable T get(int index) { if (multipleValues != null) { return (T) multipleValues[index]; } else if (valueIdx == index) { diff --git a/lib/src/main/java/com/diffplug/spotless/biome/BiomeStep.java b/lib/src/main/java/com/diffplug/spotless/biome/BiomeStep.java index 5d6134101a..66b69112d5 100644 --- a/lib/src/main/java/com/diffplug/spotless/biome/BiomeStep.java +++ b/lib/src/main/java/com/diffplug/spotless/biome/BiomeStep.java @@ -24,8 +24,8 @@ import java.nio.file.Path; import java.nio.file.attribute.PosixFilePermission; import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; +import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -299,7 +299,7 @@ private State createState() throws IOException, InterruptedException { validateBiomeExecutable(resolvedPathToExe); validateBiomeConfigPath(configPath, version); logger.debug("Using Biome executable located at '{}'", resolvedPathToExe); - var exeSignature = FileSignature.signAsList(Collections.singleton(new File(resolvedPathToExe))); + var exeSignature = FileSignature.signAsList(Set.of(new File(resolvedPathToExe))); makeExecutable(resolvedPathToExe); return new State(resolvedPathToExe, exeSignature, configPath, language); } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/EslintConfig.java b/lib/src/main/java/com/diffplug/spotless/npm/EslintConfig.java index 79fda26180..25fd1311b3 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/EslintConfig.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/EslintConfig.java @@ -40,7 +40,7 @@ public EslintConfig withEslintConfigPath(@Nullable File eslintConfigPath) { return new EslintConfig(eslintConfigPath, this.eslintConfigJs); } - @Nullable public File getEslintConfigPath() { + public @Nullable File getEslintConfigPath() { return eslintConfigPathSignature == null ? null : eslintConfigPathSignature.get().getOnlyFile(); } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java index b2a30a5278..04c07e793f 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java @@ -20,7 +20,6 @@ import java.io.File; import java.io.IOException; import java.io.Serializable; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -65,7 +64,7 @@ public static Map defaultDevDependencies() { } public static Map defaultDevDependenciesWithEslint(String version) { - return Collections.singletonMap("eslint", version); + return Map.of("eslint", version); } public static FormatterStep create(Map devDependencies, Provisioner provisioner, File projectDir, File buildDir, File cacheDir, NpmPathResolver npmPathResolver, EslintConfig eslintConfig) { diff --git a/lib/src/main/java/com/diffplug/spotless/npm/EslintTypescriptConfig.java b/lib/src/main/java/com/diffplug/spotless/npm/EslintTypescriptConfig.java index 7b948ac370..7eefa1c8ba 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/EslintTypescriptConfig.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/EslintTypescriptConfig.java @@ -39,7 +39,7 @@ public EslintConfig withEslintConfigPath(@Nullable File eslintConfigPath) { return new EslintTypescriptConfig(eslintConfigPath, this.getEslintConfigJs(), getTypescriptConfigPath()); } - @Nullable public File getTypescriptConfigPath() { + public @Nullable File getTypescriptConfigPath() { return typescriptConfigPathSignature == null ? null : this.typescriptConfigPathSignature.get().getOnlyFile(); } } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/JsonWriter.java b/lib/src/main/java/com/diffplug/spotless/npm/JsonWriter.java index bbdf9b63d4..ef8419b205 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/JsonWriter.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/JsonWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.stream.Collectors; @@ -45,7 +44,7 @@ JsonWriter putAll(Map values) { } JsonWriter put(String name, Object value) { - verifyValues(Collections.singletonMap(name, value)); + verifyValues(Map.of(name, value)); this.valueMap.put(name, value); return this; } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java index 4571db9ea6..dcd79d1ee0 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/NpmFormatterStepStateBase.java @@ -22,7 +22,6 @@ import java.io.Serial; import java.io.Serializable; import java.time.Duration; -import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; @@ -164,7 +163,7 @@ protected static String replaceDevDependencies(String template, Map replacements) { diff --git a/lib/src/main/java/com/diffplug/spotless/npm/PrettierConfig.java b/lib/src/main/java/com/diffplug/spotless/npm/PrettierConfig.java index 956de348dc..12aa16cdff 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/PrettierConfig.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/PrettierConfig.java @@ -39,7 +39,7 @@ public PrettierConfig(@Nullable File prettierConfigPath, @Nullable Map() : new TreeMap<>(options); } - @Nullable public File getPrettierConfigPath() { + public @Nullable File getPrettierConfigPath() { return prettierConfigPathSignature == null ? null : prettierConfigPathSignature.get().getOnlyFile(); } diff --git a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java index 629cd21983..34f8b92857 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java @@ -20,7 +20,6 @@ import java.io.File; import java.io.IOException; import java.io.Serializable; -import java.util.Collections; import java.util.Map; import java.util.TreeMap; @@ -48,7 +47,7 @@ public static Map defaultDevDependencies() { } public static Map defaultDevDependenciesWithPrettier(String version) { - return Collections.singletonMap("prettier", version); + return Map.of("prettier", version); } public static FormatterStep create(Map devDependencies, Provisioner provisioner, File projectDir, File buildDir, File cacheDir, NpmPathResolver npmPathResolver, PrettierConfig prettierConfig) { diff --git a/lib/src/main/java/com/diffplug/spotless/rdf/ReflectionHelper.java b/lib/src/main/java/com/diffplug/spotless/rdf/ReflectionHelper.java index 51f2aff90d..e626b5e5da 100644 --- a/lib/src/main/java/com/diffplug/spotless/rdf/ReflectionHelper.java +++ b/lib/src/main/java/com/diffplug/spotless/rdf/ReflectionHelper.java @@ -39,6 +39,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nullable; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -196,7 +198,7 @@ public DynamicErrorInvocationHandler(File file) { } @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String message = (String) args[0]; long line = (long) args[1]; long col = (long) args[2]; diff --git a/lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java b/lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java index 30319a117b..e0bfa77189 100644 --- a/lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java +++ b/lib/src/main/java/com/diffplug/spotless/scala/ScalaFmtStep.java @@ -21,6 +21,7 @@ import java.io.Serializable; import java.lang.reflect.Constructor; import java.util.Collections; +import java.util.Set; import javax.annotation.Nullable; @@ -87,7 +88,7 @@ private static final class State implements Serializable { State(JarState jarState, @Nullable File configFile) throws IOException { this.jarState = jarState; - this.configSignature = FileSignature.signAsList(configFile == null ? Collections.emptySet() : Collections.singleton(configFile)); + this.configSignature = FileSignature.signAsList(configFile == null ? Collections.emptySet() : Set.of(configFile)); } FormatterFunc createFormat() throws Exception { diff --git a/lib/src/main/java/com/diffplug/spotless/yaml/SerializeToByteArrayHack.java b/lib/src/main/java/com/diffplug/spotless/yaml/SerializeToByteArrayHack.java index 6074a78273..ece80ed4f0 100644 --- a/lib/src/main/java/com/diffplug/spotless/yaml/SerializeToByteArrayHack.java +++ b/lib/src/main/java/com/diffplug/spotless/yaml/SerializeToByteArrayHack.java @@ -46,8 +46,8 @@ public String getName() { return "hack to force serializing objects to byte array"; } - @Nullable @Override - public String format(String rawUnix, File file) throws Exception { + @Override + public @Nullable String format(String rawUnix, File file) throws Exception { return null; } diff --git a/lib/src/test/java/com/diffplug/spotless/npm/NodeServerLayoutTest.java b/lib/src/test/java/com/diffplug/spotless/npm/NodeServerLayoutTest.java index ccb5e51caa..229435eb21 100644 --- a/lib/src/test/java/com/diffplug/spotless/npm/NodeServerLayoutTest.java +++ b/lib/src/test/java/com/diffplug/spotless/npm/NodeServerLayoutTest.java @@ -42,8 +42,8 @@ void itCalculatesSameNodeModulesDirForSameContent() throws IOException { @Test void itCalculatesDifferentNodeModulesDirForDifferentPackageJson() throws IOException { File testDir = newFolder("build"); - String packageJsonContent1 = prettierPackageJson(Collections.singletonMap("prettier-plugin-xy", "^2.0.0")); - String packageJsonContent2 = prettierPackageJson(Collections.singletonMap("prettier-plugin-xy", "^2.1.0")); + String packageJsonContent1 = prettierPackageJson(Map.of("prettier-plugin-xy", "^2.0.0")); + String packageJsonContent2 = prettierPackageJson(Map.of("prettier-plugin-xy", "^2.1.0")); String serveJsContent = "fun main() { console.log('Hello, world!'); }"; NodeServerLayout layout1 = new NodeServerLayout(testDir, packageJsonContent1, serveJsContent); diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/AJacksonGradleConfig.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/AJacksonGradleConfig.java index e0b789efa3..89df049715 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/AJacksonGradleConfig.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/AJacksonGradleConfig.java @@ -15,7 +15,7 @@ */ package com.diffplug.gradle.spotless; -import java.util.Collections; +import java.util.Map; import com.diffplug.spotless.FormatterStep; import com.diffplug.spotless.json.JacksonConfig; @@ -36,7 +36,7 @@ protected AJacksonGradleConfig(JacksonConfig jacksonConfig, FormatExtension form } public T feature(String feature, boolean toggle) { - this.jacksonConfig.appendFeatureToToggle(Collections.singletonMap(feature, toggle)); + this.jacksonConfig.appendFeatureToToggle(Map.of(feature, toggle)); formatExtension.replaceStep(createStep()); return self(); } diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java index 399d8f718c..972c60155e 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavascriptExtension.java @@ -18,7 +18,6 @@ import static java.util.Objects.requireNonNull; import java.util.Arrays; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.function.Consumer; @@ -200,7 +199,7 @@ protected FormatterStep createStep() { private void fixParserToJavascript() { if (this.prettierConfig == null) { - this.prettierConfig = Collections.singletonMap("parser", DEFAULT_PRETTIER_JS_PARSER); + this.prettierConfig = Map.of("parser", DEFAULT_PRETTIER_JS_PARSER); } else { final Object currentParser = this.prettierConfig.get("parser"); if (PRETTIER_JS_PARSERS.contains(String.valueOf(currentParser))) { diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JsonExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JsonExtension.java index 8fc00c65af..0432614091 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JsonExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JsonExtension.java @@ -15,7 +15,6 @@ */ package com.diffplug.gradle.spotless; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -165,7 +164,7 @@ public JacksonJsonGradleConfig(FormatExtension formatExtension) { * Refers to com.fasterxml.jackson.core.JsonGenerator.Feature */ public JacksonJsonGradleConfig jsonFeature(String feature, boolean toggle) { - this.jacksonConfig.appendJsonFeatureToToggle(Collections.singletonMap(feature, toggle)); + this.jacksonConfig.appendJsonFeatureToToggle(Map.of(feature, toggle)); formatExtension.replaceStep(createStep()); return this; } diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java index b2b7826570..0d5838c24a 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/TypescriptExtension.java @@ -169,7 +169,7 @@ protected FormatterStep createStep() { private void fixParserToTypescript() { if (this.prettierConfig == null) { - this.prettierConfig = new TreeMap<>(Collections.singletonMap("parser", "typescript")); + this.prettierConfig = new TreeMap<>(Map.of("parser", "typescript")); } else { final Object replaced = this.prettierConfig.put("parser", "typescript"); if (replaced != null) { diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/YamlExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/YamlExtension.java index c0872e8fb9..9551538654 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/YamlExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/YamlExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ package com.diffplug.gradle.spotless; -import java.util.Collections; +import java.util.Map; import javax.inject.Inject; @@ -62,7 +62,7 @@ public JacksonYamlGradleConfig(FormatExtension formatExtension) { * Refers to com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature */ public JacksonYamlGradleConfig yamlFeature(String feature, boolean toggle) { - this.jacksonConfig.appendYamlFeatureToToggle(Collections.singletonMap(feature, toggle)); + this.jacksonConfig.appendYamlFeatureToToggle(Map.of(feature, toggle)); formatExtension.replaceStep(createStep()); return this; } diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FormatTaskTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FormatTaskTest.java index 0d10cf54e3..6358b298fd 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FormatTaskTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/FormatTaskTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package com.diffplug.gradle.spotless; import java.io.File; -import java.util.Collections; import java.util.List; +import java.util.Set; import org.gradle.api.Project; import org.gradle.api.services.BuildServiceParameters; @@ -50,7 +50,7 @@ void testLineEndings() throws Exception { File testFile = setFile("testFile").toContent("\r\n"); File outputFile = new File(spotlessTask.getCleanDirectory(), "testFile"); - spotlessTask.setTarget(Collections.singleton(testFile)); + spotlessTask.setTarget(Set.of(testFile)); Tasks.execute(spotlessTask); assertFile(outputFile).hasContent("\n"); @@ -60,7 +60,7 @@ void testLineEndings() throws Exception { void testStep() throws Exception { File testFile = setFile("testFile").toContent("apple"); File outputFile = new File(spotlessTask.getCleanDirectory(), "testFile"); - spotlessTask.setTarget(Collections.singleton(testFile)); + spotlessTask.setTarget(Set.of(testFile)); spotlessTask.setSteps(List.of(ReplaceStep.create("double-p", "pp", "p"))); Tasks.execute(spotlessTask); diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/FileLocator.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/FileLocator.java index 3781d404be..e2f5fb1f79 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/FileLocator.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/FileLocator.java @@ -27,6 +27,8 @@ import java.util.Base64; import java.util.Objects; +import javax.annotation.Nullable; + import org.codehaus.plexus.resource.ResourceManager; import org.codehaus.plexus.resource.loader.FileResourceCreationException; import org.codehaus.plexus.resource.loader.ResourceNotFoundException; @@ -52,7 +54,7 @@ public FileLocator(ResourceManager resourceManager, File baseDir, File buildDir) * If the given path is a local file returns it as such unchanged, otherwise * extracts the given resource to a randomly-named file in the build folder. */ - public File locateFile(String path) { + public @Nullable File locateFile(String path) { if (isNullOrEmpty(path)) { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/css/Css.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/css/Css.java index 4d465d8939..98450b7692 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/css/Css.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/css/Css.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 DiffPlug + * Copyright 2023-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -32,7 +34,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/Format.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/Format.java index ccdef479cf..97059cd8f3 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/Format.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/generic/Format.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -36,7 +38,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { // do not specify a default delimiter return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/gherkin/Gherkin.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/gherkin/Gherkin.java index 60181d048a..e4f478d8cc 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/gherkin/Gherkin.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/gherkin/Gherkin.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 DiffPlug + * Copyright 2023-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -32,7 +34,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/go/Go.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/go/Go.java index bb26bd0355..e89c1782a1 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/go/Go.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/go/Go.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 DiffPlug + * Copyright 2024-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -29,7 +31,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/FileIndex.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/FileIndex.java index 2a8955aec1..100404499f 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/FileIndex.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/FileIndex.java @@ -34,12 +34,12 @@ import java.util.Map.Entry; import java.util.TreeMap; +import javax.annotation.Nullable; + import org.apache.maven.plugin.logging.Log; import com.diffplug.common.annotations.VisibleForTesting; -import jakarta.annotation.Nullable; - final class FileIndex { private static final String SEPARATOR = " "; diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java index b02da5bf1b..4588bcb58f 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/incremental/UpToDateChecking.java @@ -18,9 +18,9 @@ import java.io.File; import java.nio.file.Path; -import org.apache.maven.plugins.annotations.Parameter; +import javax.annotation.Nullable; -import jakarta.annotation.Nullable; +import org.apache.maven.plugins.annotations.Parameter; public class UpToDateChecking { @@ -34,7 +34,7 @@ public boolean isEnabled() { return enabled; } - @Nullable public Path getIndexFile() { + public @Nullable Path getIndexFile() { return indexFile == null ? null : new File(indexFile).toPath(); } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/javascript/Javascript.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/javascript/Javascript.java index dc2949ae68..70c48a8cc6 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/javascript/Javascript.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/javascript/Javascript.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -34,7 +36,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/json/Json.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/json/Json.java index 80767f41f3..b1aa25465a 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/json/Json.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/json/Json.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 DiffPlug + * Copyright 2023-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -34,7 +36,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/markdown/Markdown.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/markdown/Markdown.java index 0941beb76a..e3d20994bd 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/markdown/Markdown.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/markdown/Markdown.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 DiffPlug + * Copyright 2021-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -36,7 +38,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/npm/AbstractNpmFormatterStepFactory.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/npm/AbstractNpmFormatterStepFactory.java index 03dd87e898..8a9c3990c9 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/npm/AbstractNpmFormatterStepFactory.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/npm/AbstractNpmFormatterStepFactory.java @@ -19,7 +19,7 @@ import java.nio.file.Path; import java.util.AbstractMap; import java.util.Arrays; -import java.util.Collections; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; @@ -79,7 +79,7 @@ protected File baseDir(FormatterStepConfig stepConfig) { } protected NpmPathResolver npmPathResolver(FormatterStepConfig stepConfig) { - return new NpmPathResolver(npm(stepConfig), node(stepConfig), npmrc(stepConfig), Collections.singletonList(baseDir(stepConfig))); + return new NpmPathResolver(npm(stepConfig), node(stepConfig), npmrc(stepConfig), List.of(baseDir(stepConfig))); } protected boolean moreThanOneNonNull(Object... objects) { diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/pom/Pom.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/pom/Pom.java index 9a4d3eea06..6d87776b88 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/pom/Pom.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/pom/Pom.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 DiffPlug + * Copyright 2021-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.common.collect.ImmutableSet; @@ -36,7 +38,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/python/Python.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/python/Python.java index df7348c16c..8c4e971f3c 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/python/Python.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/python/Python.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 DiffPlug + * Copyright 2021-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -37,7 +39,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/rdf/Rdf.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/rdf/Rdf.java index d92e09aa58..c58bf92aae 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/rdf/Rdf.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/rdf/Rdf.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 DiffPlug + * Copyright 2024-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -29,7 +31,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/shell/Shell.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/shell/Shell.java index 0626c5ceb9..c114bb269c 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/shell/Shell.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/shell/Shell.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 DiffPlug + * Copyright 2024-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -37,7 +39,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/sql/Sql.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/sql/Sql.java index 64ebcb55d7..084dbae35a 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/sql/Sql.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/sql/Sql.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 DiffPlug + * Copyright 2020-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -34,7 +36,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/typescript/Typescript.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/typescript/Typescript.java index 2646ca05b0..8f10441233 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/typescript/Typescript.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/typescript/Typescript.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -34,7 +36,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/yaml/Yaml.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/yaml/Yaml.java index e22f6d40ce..579a0a3124 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/yaml/Yaml.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/yaml/Yaml.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 DiffPlug + * Copyright 2023-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ import java.util.Collections; import java.util.Set; +import javax.annotation.Nullable; + import org.apache.maven.project.MavenProject; import com.diffplug.spotless.maven.FormatterFactory; @@ -32,7 +34,7 @@ public Set defaultIncludes(MavenProject project) { } @Override - public String licenseHeaderDelimiter() { + public @Nullable String licenseHeaderDelimiter() { return null; } diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenIntegrationHarness.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenIntegrationHarness.java index 3065840b83..5e3eb0f46b 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenIntegrationHarness.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MavenIntegrationHarness.java @@ -17,7 +17,6 @@ import static com.diffplug.common.base.Strings.isNullOrEmpty; import static java.util.Arrays.stream; -import static java.util.Collections.singletonMap; import static java.util.stream.Collectors.toList; import static org.junit.jupiter.api.Assertions.fail; @@ -298,7 +297,7 @@ protected static Map buildPomXmlParams(String pluginVersion, Str } if (modules != null) { - List> moduleNames = stream(modules).map(name -> singletonMap(MODULE_NAME, name)).collect(toList()); + List> moduleNames = stream(modules).map(name -> Map.of(MODULE_NAME, name)).collect(toList()); params.put(MODULES, moduleNames); } diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java index 108f9b1fe7..2182b3e246 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/MultiModuleProjectTest.java @@ -17,7 +17,6 @@ import static java.util.Arrays.asList; import static java.util.Collections.emptyMap; -import static java.util.Collections.singletonMap; import java.io.IOException; import java.util.ArrayList; @@ -163,7 +162,7 @@ private void createSubProjects() throws IOException { String subProjectName = entry.getKey(); List subProjectFiles = entry.getValue(); - String content = createPomXmlContent("/multi-module/pom-child.xml.mustache", singletonMap(CHILD_ID, subProjectName)); + String content = createPomXmlContent("/multi-module/pom-child.xml.mustache", Map.of(CHILD_ID, subProjectName)); setFile(subProjectName + "/pom.xml").toContent(content); createSubProjectFiles(subProjectName, subProjectFiles); diff --git a/rewrite.yml b/rewrite.yml index 8518825481..e9e7426fca 100644 --- a/rewrite.yml +++ b/rewrite.yml @@ -17,9 +17,15 @@ recipeList: - org.openrewrite.java.format.NormalizeLineBreaks - org.openrewrite.java.format.RemoveTrailingWhitespace - org.openrewrite.java.migrate.UpgradeToJava17 + - org.openrewrite.java.migrate.util.JavaUtilAPIs + - org.openrewrite.java.migrate.util.MigrateInflaterDeflaterToClose + - org.openrewrite.java.migrate.util.ReplaceStreamCollectWithToList + - org.openrewrite.java.migrate.util.SequencedCollection - org.openrewrite.java.recipes.JavaRecipeBestPractices + - org.openrewrite.java.recipes.RecipeNullabilityBestPractices - org.openrewrite.java.recipes.RecipeTestingBestPractices - org.openrewrite.java.security.JavaSecurityBestPractices + - org.openrewrite.staticanalysis.BufferedWriterCreationRecipes - org.openrewrite.staticanalysis.CommonStaticAnalysis - org.openrewrite.staticanalysis.EqualsAvoidsNull - org.openrewrite.staticanalysis.JavaApiBestPractices @@ -32,6 +38,9 @@ recipeList: - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields - org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods + - org.openrewrite.staticanalysis.ReplaceApacheCommonsLang3ValidateNotNullWithObjectsRequireNonNull + - org.openrewrite.staticanalysis.SimplifyTernaryRecipes + - org.openrewrite.staticanalysis.URLEqualsHashCodeRecipes - org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources - org.openrewrite.staticanalysis.UnnecessaryExplicitTypeArguments - org.openrewrite.staticanalysis.UnnecessaryParentheses @@ -55,3 +64,28 @@ recipeList: - tech.picnic.errorprone.refasterrules.StringRulesRecipes - tech.picnic.errorprone.refasterrules.TimeRulesRecipes --- +name: com.diffplug.spotless.openrewrite.SpotlessFormat +styleConfigs: + - org.openrewrite.java.style.ImportLayoutStyle: + classCountToUseStarImport: 999 + nameCountToUseStarImport: 999 + # bug https://github.com/openrewrite/rewrite/issues/6107 + # layout: + # - import java.* + # - + # - import javax.* + # - + # - import org.* + # - + # - import com.* + # - + # - import com.diffplug.* + # - + # - import static all other imports + # - + # - import all other imports + # - + - org.openrewrite.java.style.TabsAndIndentsStyle: + useTabCharacter: true + tabSize: 4 +--- diff --git a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java index 4e1d168a2a..2adc8effa1 100644 --- a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java +++ b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java @@ -20,6 +20,7 @@ import java.util.stream.Collectors; import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * A helper class to create dev dependencies for eslint when using one of the popular styleguides in testing. @@ -92,7 +93,7 @@ public enum EslintStyleGuide { public abstract @Nonnull Map devDependencies(); - public static EslintStyleGuide fromNameOrNull(String popularStyleGuideName) { + public static @Nullable EslintStyleGuide fromNameOrNull(String popularStyleGuideName) { for (EslintStyleGuide popularStyleGuide : EslintStyleGuide.values()) { if (popularStyleGuide.popularStyleGuideName.equals(popularStyleGuideName)) { return popularStyleGuide;