Skip to content

Commit ffbe627

Browse files
authored
Apply spotless (#471)
1 parent 94a9cf3 commit ffbe627

File tree

6 files changed

+104
-104
lines changed

6 files changed

+104
-104
lines changed

pom.xml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@
1111
<artifactId>dark-theme</artifactId>
1212
<version>${changelist}</version>
1313
<packaging>hpi</packaging>
14+
<name>Dark Theme</name>
15+
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
16+
17+
<licenses>
18+
<license>
19+
<name>MIT License</name>
20+
<url>https://opensource.org/licenses/MIT</url>
21+
</license>
22+
</licenses>
23+
24+
<developers>
25+
<developer>
26+
<id>timja</id>
27+
<name>Tim Jacomb</name>
28+
</developer>
29+
</developers>
30+
31+
<scm>
32+
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
33+
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
34+
<tag>${scmTag}</tag>
35+
<url>https://github.com/${gitHubRepo}</url>
36+
</scm>
1437
<properties>
1538
<gitHubRepo>jenkinsci/dark-theme-plugin</gitHubRepo>
1639
<changelist>9999999-SNAPSHOT</changelist>
@@ -19,17 +42,16 @@
1942
<useBeta>true</useBeta>
2043
<node.version>18.19.1</node.version>
2144
<npm.version>10.4.0</npm.version>
45+
<spotless.check.skip>false</spotless.check.skip>
2246
</properties>
23-
<name>Dark Theme</name>
24-
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
2547
<dependencyManagement>
2648
<dependencies>
2749
<dependency>
2850
<groupId>io.jenkins.tools.bom</groupId>
2951
<artifactId>bom-2.426.x</artifactId>
3052
<version>2815.vf5d6f093b_23e</version>
31-
<scope>import</scope>
3253
<type>pom</type>
54+
<scope>import</scope>
3355
</dependency>
3456
</dependencies>
3557
</dependencyManagement>
@@ -53,27 +75,6 @@
5375
</dependency>
5476
</dependencies>
5577

56-
<licenses>
57-
<license>
58-
<name>MIT License</name>
59-
<url>https://opensource.org/licenses/MIT</url>
60-
</license>
61-
</licenses>
62-
63-
<developers>
64-
<developer>
65-
<id>timja</id>
66-
<name>Tim Jacomb</name>
67-
</developer>
68-
</developers>
69-
70-
<scm>
71-
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
72-
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
73-
<url>https://github.com/${gitHubRepo}</url>
74-
<tag>${scmTag}</tag>
75-
</scm>
76-
7778
<repositories>
7879
<repository>
7980
<id>repo.jenkins-ci.org</id>

src/main/java/io/jenkins/plugins/darktheme/DarkThemeManagerFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public class DarkThemeManagerFactory extends ThemeManagerFactory {
1818
public static final String ENTRA_ID_THEME = "dark";
1919

2020
@DataBoundConstructor
21-
public DarkThemeManagerFactory() {
22-
}
21+
public DarkThemeManagerFactory() {}
2322

2423
@Override
2524
public Theme getTheme() {

src/main/java/io/jenkins/plugins/darktheme/DarkThemeRootAction.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package io.jenkins.plugins.darktheme;
22

3+
import static io.jenkins.plugins.darktheme.DarkThemeManagerFactory.THEME_CSS;
4+
import static io.jenkins.plugins.darktheme.DarkThemeManagerFactory.THEME_URL_NAME;
5+
36
import hudson.Extension;
47
import hudson.Plugin;
58
import hudson.model.UnprotectedRootAction;
@@ -12,9 +15,6 @@
1215
import org.kohsuke.stapler.StaplerRequest;
1316
import org.kohsuke.stapler.StaplerResponse;
1417

15-
import static io.jenkins.plugins.darktheme.DarkThemeManagerFactory.THEME_CSS;
16-
import static io.jenkins.plugins.darktheme.DarkThemeManagerFactory.THEME_URL_NAME;
17-
1818
@Extension
1919
@Restricted(NoExternalUse.class)
2020
public class DarkThemeRootAction implements UnprotectedRootAction {
@@ -34,7 +34,8 @@ public String getUrlName() {
3434
return THEME_URL_NAME;
3535
}
3636

37-
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, URISyntaxException, ServletException {
37+
public void doDynamic(StaplerRequest req, StaplerResponse rsp)
38+
throws IOException, URISyntaxException, ServletException {
3839
String cssFile = req.getRestOfPath();
3940
if (cssFile.startsWith("/")) {
4041
cssFile = cssFile.substring(1);
@@ -48,6 +49,6 @@ public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOExceptio
4849
rsp.sendError(404);
4950
return;
5051
}
51-
plugin.doDynamic(req,rsp);
52+
plugin.doDynamic(req, rsp);
5253
}
5354
}

src/main/java/io/jenkins/plugins/darktheme/DarkThemeSystemManagerFactory.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.jenkins.plugins.darktheme;
22

3+
import static io.jenkins.plugins.darktheme.DarkThemeManagerFactory.*;
4+
35
import edu.umd.cs.findbugs.annotations.NonNull;
46
import hudson.Extension;
57
import io.jenkins.plugins.thememanager.Theme;
@@ -8,23 +10,20 @@
810
import org.jenkinsci.Symbol;
911
import org.kohsuke.stapler.DataBoundConstructor;
1012

11-
import static io.jenkins.plugins.darktheme.DarkThemeManagerFactory.*;
12-
1313
public class DarkThemeSystemManagerFactory extends ThemeManagerFactory {
1414

1515
@DataBoundConstructor
16-
public DarkThemeSystemManagerFactory() {
17-
}
16+
public DarkThemeSystemManagerFactory() {}
1817

1918
@Override
2019
public Theme getTheme() {
2120
return Theme.builder()
22-
.respectSystemAppearance()
23-
.withProperty("ace-editor", "theme-dark", ACE_EDITOR_THEME)
24-
.withProperty("entra-id", "theme-dark", ENTRA_ID_THEME)
25-
.withProperty("prism-api", "theme-dark", PRISM_THEME)
26-
.withProperty("bootstrap", "theme-dark", BOOTSTRAP_THEME)
27-
.build();
21+
.respectSystemAppearance()
22+
.withProperty("ace-editor", "theme-dark", ACE_EDITOR_THEME)
23+
.withProperty("entra-id", "theme-dark", ENTRA_ID_THEME)
24+
.withProperty("prism-api", "theme-dark", PRISM_THEME)
25+
.withProperty("bootstrap", "theme-dark", BOOTSTRAP_THEME)
26+
.build();
2827
}
2928

3029
@Extension
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package io.jenkins.plugins.darktheme.jcasc.dark;
22

3+
import static io.jenkins.plugins.casc.misc.Util.toStringFromYamlFile;
4+
import static io.jenkins.plugins.casc.misc.Util.toYamlString;
5+
import static org.hamcrest.MatcherAssert.assertThat;
6+
import static org.hamcrest.Matchers.instanceOf;
7+
import static org.hamcrest.Matchers.is;
8+
import static org.junit.Assert.assertNotNull;
9+
310
import hudson.ExtensionList;
411
import io.jenkins.plugins.casc.ConfigurationContext;
512
import io.jenkins.plugins.casc.ConfiguratorRegistry;
@@ -8,56 +15,49 @@
815
import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule;
916
import io.jenkins.plugins.casc.model.CNode;
1017
import io.jenkins.plugins.casc.model.Mapping;
11-
import java.util.Objects;
12-
import jenkins.appearance.AppearanceCategory;
13-
import jenkins.model.GlobalConfigurationCategory;
1418
import io.jenkins.plugins.darktheme.DarkThemeManagerFactory;
1519
import io.jenkins.plugins.thememanager.ThemeManagerFactory;
1620
import io.jenkins.plugins.thememanager.ThemeManagerPageDecorator;
21+
import java.util.Objects;
22+
import jenkins.appearance.AppearanceCategory;
23+
import jenkins.model.GlobalConfigurationCategory;
1724
import org.junit.ClassRule;
1825
import org.junit.Test;
1926

20-
import static io.jenkins.plugins.casc.misc.Util.toStringFromYamlFile;
21-
import static io.jenkins.plugins.casc.misc.Util.toYamlString;
22-
import static org.hamcrest.MatcherAssert.assertThat;
23-
import static org.hamcrest.Matchers.instanceOf;
24-
import static org.hamcrest.Matchers.is;
25-
import static org.junit.Assert.assertNotNull;
26-
2727
public class DarkThemeJcascTest {
2828

29-
@ClassRule
30-
@ConfiguredWithCode("ConfigurationAsCode.yml")
31-
public static JenkinsConfiguredWithCodeRule j = new JenkinsConfiguredWithCodeRule();
29+
@ClassRule
30+
@ConfiguredWithCode("ConfigurationAsCode.yml")
31+
public static JenkinsConfiguredWithCodeRule j = new JenkinsConfiguredWithCodeRule();
3232

33-
@Test
34-
public void testConfig() {
35-
ThemeManagerPageDecorator decorator = ThemeManagerPageDecorator.get();
33+
@Test
34+
public void testConfig() {
35+
ThemeManagerPageDecorator decorator = ThemeManagerPageDecorator.get();
3636

37-
ThemeManagerFactory theme = decorator.getTheme();
38-
assertNotNull(theme);
37+
ThemeManagerFactory theme = decorator.getTheme();
38+
assertNotNull(theme);
3939

40-
assertThat(decorator.isDisableUserThemes(), is(true));
41-
assertThat(theme, instanceOf(DarkThemeManagerFactory.class));
42-
}
40+
assertThat(decorator.isDisableUserThemes(), is(true));
41+
assertThat(theme, instanceOf(DarkThemeManagerFactory.class));
42+
}
4343

44-
@Test
45-
public void testExport() throws Exception {
46-
ConfigurationContext context = new ConfigurationContext(ConfiguratorRegistry.get());
47-
CNode yourAttribute = getAppearanceRoot(context).get("themeManager");
44+
@Test
45+
public void testExport() throws Exception {
46+
ConfigurationContext context = new ConfigurationContext(ConfiguratorRegistry.get());
47+
CNode yourAttribute = getAppearanceRoot(context).get("themeManager");
4848

49-
String exported = toYamlString(yourAttribute);
49+
String exported = toYamlString(yourAttribute);
5050

51-
String expected = toStringFromYamlFile(this, "ConfigurationAsCodeExport.yml");
51+
String expected = toStringFromYamlFile(this, "ConfigurationAsCodeExport.yml");
5252

53-
assertThat(exported, is(expected));
54-
}
53+
assertThat(exported, is(expected));
54+
}
5555

56-
public static Mapping getAppearanceRoot(ConfigurationContext context) throws Exception {
57-
GlobalConfigurationCategory category =
58-
ExtensionList.lookup(AppearanceCategory.class).get(0);
59-
GlobalConfigurationCategoryConfigurator configurator = new GlobalConfigurationCategoryConfigurator(category);
60-
return Objects.requireNonNull(configurator.describe(configurator.getTargetComponent(context), context))
61-
.asMapping();
62-
}
56+
public static Mapping getAppearanceRoot(ConfigurationContext context) throws Exception {
57+
GlobalConfigurationCategory category =
58+
ExtensionList.lookup(AppearanceCategory.class).get(0);
59+
GlobalConfigurationCategoryConfigurator configurator = new GlobalConfigurationCategoryConfigurator(category);
60+
return Objects.requireNonNull(configurator.describe(configurator.getTargetComponent(context), context))
61+
.asMapping();
62+
}
6363
}
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package io.jenkins.plugins.darktheme.jcasc.darksystem;
22

3+
import static io.jenkins.plugins.casc.misc.Util.toStringFromYamlFile;
4+
import static io.jenkins.plugins.casc.misc.Util.toYamlString;
5+
import static io.jenkins.plugins.darktheme.jcasc.dark.DarkThemeJcascTest.getAppearanceRoot;
6+
import static org.hamcrest.MatcherAssert.assertThat;
7+
import static org.hamcrest.Matchers.instanceOf;
8+
import static org.hamcrest.Matchers.is;
9+
import static org.junit.Assert.assertNotNull;
10+
311
import io.jenkins.plugins.casc.ConfigurationContext;
412
import io.jenkins.plugins.casc.ConfiguratorRegistry;
513
import io.jenkins.plugins.casc.misc.ConfiguredWithCode;
@@ -11,40 +19,32 @@
1119
import org.junit.ClassRule;
1220
import org.junit.Test;
1321

14-
import static io.jenkins.plugins.casc.misc.Util.toStringFromYamlFile;
15-
import static io.jenkins.plugins.casc.misc.Util.toYamlString;
16-
import static io.jenkins.plugins.darktheme.jcasc.dark.DarkThemeJcascTest.getAppearanceRoot;
17-
import static org.hamcrest.MatcherAssert.assertThat;
18-
import static org.hamcrest.Matchers.instanceOf;
19-
import static org.hamcrest.Matchers.is;
20-
import static org.junit.Assert.assertNotNull;
21-
2222
public class DarkSystemThemeJcascTest {
2323

24-
@ClassRule
25-
@ConfiguredWithCode("ConfigurationAsCode.yml")
26-
public static JenkinsConfiguredWithCodeRule j = new JenkinsConfiguredWithCodeRule();
24+
@ClassRule
25+
@ConfiguredWithCode("ConfigurationAsCode.yml")
26+
public static JenkinsConfiguredWithCodeRule j = new JenkinsConfiguredWithCodeRule();
2727

28-
@Test
29-
public void testConfig() {
30-
ThemeManagerPageDecorator decorator = ThemeManagerPageDecorator.get();
28+
@Test
29+
public void testConfig() {
30+
ThemeManagerPageDecorator decorator = ThemeManagerPageDecorator.get();
3131

32-
ThemeManagerFactory theme = decorator.getTheme();
33-
assertNotNull(theme);
32+
ThemeManagerFactory theme = decorator.getTheme();
33+
assertNotNull(theme);
3434

35-
assertThat(decorator.isDisableUserThemes(), is(true));
36-
assertThat(theme, instanceOf(DarkThemeSystemManagerFactory.class));
37-
}
35+
assertThat(decorator.isDisableUserThemes(), is(true));
36+
assertThat(theme, instanceOf(DarkThemeSystemManagerFactory.class));
37+
}
3838

39-
@Test
40-
public void testExport() throws Exception {
41-
ConfigurationContext context = new ConfigurationContext(ConfiguratorRegistry.get());
42-
CNode yourAttribute = getAppearanceRoot(context).get("themeManager");
39+
@Test
40+
public void testExport() throws Exception {
41+
ConfigurationContext context = new ConfigurationContext(ConfiguratorRegistry.get());
42+
CNode yourAttribute = getAppearanceRoot(context).get("themeManager");
4343

44-
String exported = toYamlString(yourAttribute);
44+
String exported = toYamlString(yourAttribute);
4545

46-
String expected = toStringFromYamlFile(this, "ConfigurationAsCodeExport.yml");
46+
String expected = toStringFromYamlFile(this, "ConfigurationAsCodeExport.yml");
4747

48-
assertThat(exported, is(expected));
49-
}
48+
assertThat(exported, is(expected));
49+
}
5050
}

0 commit comments

Comments
 (0)