From 827f23da07926ed94720f07c33512f9923d41fb1 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sun, 14 Jul 2024 17:50:43 -0400 Subject: [PATCH] [ci] formatting based on current rules --- pom.xml | 4 +-- .../formatter/AbstractCacheableFormatter.java | 2 +- .../revelc/code/formatter/FormatterMojo.java | 8 +++-- .../code/formatter/AbstractFormatterTest.java | 36 +++++++++---------- .../revelc/code/formatter/LineEndingTest.java | 6 ---- .../revelc/code/formatter/TimeUtilTest.java | 1 - .../code/formatter/css/CssFormatterTest.java | 2 -- .../formatter/html/HTMLFormatterTest.java | 2 -- .../formatter/java/JavaFormatterTest.java | 6 ---- .../javascript/JavascriptFormatterTest.java | 2 -- .../formatter/json/JsonFormatterTest.java | 2 -- .../code/formatter/xml/XMLFormatterTest.java | 2 -- 12 files changed, 26 insertions(+), 47 deletions(-) diff --git a/pom.xml b/pom.xml index 90ba9bef..b68c4a53 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,6 @@ scm:git:ssh://git@github.com/revelc/formatter-maven-plugin.git - ${project.basedir}/src/main/resources/formatter-maven-plugin/eclipse/java.xml true @@ -82,11 +81,10 @@ java.,javax.,org.,com.,net. all 17 - + false 2.0.0-M9 4.0.0-M15 - false diff --git a/src/main/java/net/revelc/code/formatter/AbstractCacheableFormatter.java b/src/main/java/net/revelc/code/formatter/AbstractCacheableFormatter.java index b023d237..2cca2d0c 100644 --- a/src/main/java/net/revelc/code/formatter/AbstractCacheableFormatter.java +++ b/src/main/java/net/revelc/code/formatter/AbstractCacheableFormatter.java @@ -130,7 +130,7 @@ private static String fixLineEnding(String code, final LineEnding ending) { /** * Do format. - * + *

* notice that when calling this function, {@code ending} here MUST equals lineending in config when * {@link #init(Map, ConfigurationSource)} init. * diff --git a/src/main/java/net/revelc/code/formatter/FormatterMojo.java b/src/main/java/net/revelc/code/formatter/FormatterMojo.java index 0ddabbbc..b6941687 100644 --- a/src/main/java/net/revelc/code/formatter/FormatterMojo.java +++ b/src/main/java/net/revelc/code/formatter/FormatterMojo.java @@ -775,7 +775,8 @@ protected void doFormatFile(final File file, final ResultCollector rc, final Pro // Process the result type if (Result.SKIPPED.equals(result)) { - // Use unchanged count for files that either 'skipFormattingCache' or cache missed but flagged to skip formatting. + // Use unchanged count for files that either 'skipFormattingCache' or cache missed but flagged to skip + // formatting. rc.unchangedCount++; } else if (Result.SUCCESS.equals(result)) { rc.successCount++; @@ -1112,7 +1113,10 @@ static class ResultCollector { /** The skipped count is incremented for cached files that haven't changed since being cached. */ int skippedCount; - /** Use unchanged count for files that either 'skipFormattingCache' or cache missed but flagged to skip formatting. */ + /** + * Use unchanged count for files that either 'skipFormattingCache' or cache missed but flagged to skip + * formatting. + */ int unchangedCount; /** The read only count. */ diff --git a/src/test/java/net/revelc/code/formatter/AbstractFormatterTest.java b/src/test/java/net/revelc/code/formatter/AbstractFormatterTest.java index f3411540..18cbcf14 100644 --- a/src/test/java/net/revelc/code/formatter/AbstractFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/AbstractFormatterTest.java @@ -200,16 +200,16 @@ private void doTestFormat(final Map options, final Formatter for // Set the used output directory for test (either first pass or second pass) File testOutputDir; switch (formatCycle) { - case 1: - resourceLocation = AbstractFormatterTest.RESOURCE_LOCATION_PRIMARY; - testOutputDir = AbstractFormatterTest.TEST_OUTPUT_PRIMARY_DIR; - break; - case 2: - resourceLocation = AbstractFormatterTest.RESOURCE_LOCATION_SECONDARY; - testOutputDir = AbstractFormatterTest.TEST_OUTPUT_SECONDARY_DIR; - break; - default: - throw new IllegalStateException("Unrecognized format cycle: " + formatCycle); + case 1: + resourceLocation = AbstractFormatterTest.RESOURCE_LOCATION_PRIMARY; + testOutputDir = AbstractFormatterTest.TEST_OUTPUT_PRIMARY_DIR; + break; + case 2: + resourceLocation = AbstractFormatterTest.RESOURCE_LOCATION_SECONDARY; + testOutputDir = AbstractFormatterTest.TEST_OUTPUT_SECONDARY_DIR; + break; + default: + throw new IllegalStateException("Unrecognized format cycle: " + formatCycle); } // Set original file and file to use for test @@ -234,14 +234,14 @@ private void doTestFormat(final Map options, final Formatter for // Run assertions on formatted file, if not valid, reject and tester can look at resulting files // to debug issue. switch (formatCycle) { - case 1: - Assertions.assertNotEquals(originalCode, formattedCode); - break; - case 2: - Assertions.assertEquals(originalCode, formattedCode); - break; - default: - throw new IllegalStateException("Unrecognized format cycle: " + formatCycle); + case 1: + Assertions.assertNotEquals(originalCode, formattedCode); + break; + case 2: + Assertions.assertEquals(originalCode, formattedCode); + break; + default: + throw new IllegalStateException("Unrecognized format cycle: " + formatCycle); } // We are hashing this as set in stone in case for some reason our source file changes unexpectedly. diff --git a/src/test/java/net/revelc/code/formatter/LineEndingTest.java b/src/test/java/net/revelc/code/formatter/LineEndingTest.java index d0bb713d..7e405ad6 100644 --- a/src/test/java/net/revelc/code/formatter/LineEndingTest.java +++ b/src/test/java/net/revelc/code/formatter/LineEndingTest.java @@ -24,7 +24,6 @@ class LineEndingTest { /** * Test successfully determining CRLF line ending. - * */ @Test void test_success_read_line_endings_crlf() { @@ -35,7 +34,6 @@ void test_success_read_line_endings_crlf() { /** * Test successfully determining LF line ending. - * */ @Test void test_success_read_line_endings_lf() { @@ -46,7 +44,6 @@ void test_success_read_line_endings_lf() { /** * Test successfully determining CR line ending. - * */ @Test void test_success_read_line_endings_cr() { @@ -57,7 +54,6 @@ void test_success_read_line_endings_cr() { /** * Test successfully determining LF line ending with mixed endings. - * */ @Test void test_success_read_line_endings_mixed_lf() { @@ -68,7 +64,6 @@ void test_success_read_line_endings_mixed_lf() { /** * Test successfully determining AUTO line ending with mixed endings and no clear majority. - * */ @Test void test_success_read_line_endings_mixed_auto() { @@ -79,7 +74,6 @@ void test_success_read_line_endings_mixed_auto() { /** * Test successfully determining AUTO line ending with no endings. - * */ @Test void test_success_read_line_endings_none_auto() { diff --git a/src/test/java/net/revelc/code/formatter/TimeUtilTest.java b/src/test/java/net/revelc/code/formatter/TimeUtilTest.java index a0d7d382..7b709ea7 100644 --- a/src/test/java/net/revelc/code/formatter/TimeUtilTest.java +++ b/src/test/java/net/revelc/code/formatter/TimeUtilTest.java @@ -24,7 +24,6 @@ class TimeUtilTest { /** * Test print duration. - * */ @Test void testPrintDuration() { diff --git a/src/test/java/net/revelc/code/formatter/css/CssFormatterTest.java b/src/test/java/net/revelc/code/formatter/css/CssFormatterTest.java index f9c6c620..68d1e2df 100644 --- a/src/test/java/net/revelc/code/formatter/css/CssFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/css/CssFormatterTest.java @@ -29,7 +29,6 @@ class CssFormatterTest extends AbstractFormatterTest { /** * Test do format file. - * */ @Test void testDoFormatFile() { @@ -43,7 +42,6 @@ void testDoFormatFile() { /** * Test is initialized. - * */ @Test void testIsInitialized() { diff --git a/src/test/java/net/revelc/code/formatter/html/HTMLFormatterTest.java b/src/test/java/net/revelc/code/formatter/html/HTMLFormatterTest.java index 8f56179c..bc994f3e 100644 --- a/src/test/java/net/revelc/code/formatter/html/HTMLFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/html/HTMLFormatterTest.java @@ -29,7 +29,6 @@ class HTMLFormatterTest extends AbstractFormatterTest { /** * Test do format file. - * */ @Test void testDoFormatFile() { @@ -43,7 +42,6 @@ void testDoFormatFile() { /** * Test is initialized. - * */ @Test void testIsInitialized() { diff --git a/src/test/java/net/revelc/code/formatter/java/JavaFormatterTest.java b/src/test/java/net/revelc/code/formatter/java/JavaFormatterTest.java index e33d187f..bb470b85 100644 --- a/src/test/java/net/revelc/code/formatter/java/JavaFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/java/JavaFormatterTest.java @@ -29,7 +29,6 @@ class JavaFormatterTest extends AbstractFormatterTest { /** * Test do format file. - * */ @Test void testDoFormatFile() { @@ -42,7 +41,6 @@ void testDoFormatFile() { /** * Test do format file keep line feed LF. - * */ @Test void testDoFormatFileKeepLineFeedLF() { @@ -52,7 +50,6 @@ void testDoFormatFileKeepLineFeedLF() { /** * Test do format file keep line feed CR. - * */ @Test void testDoFormatFileKeepLineFeedCR() { @@ -62,7 +59,6 @@ void testDoFormatFileKeepLineFeedCR() { /** * Test do format file keep line feed CRLF. - * */ @Test void testDoFormatFileKeepLineFeedCRLF() { @@ -73,7 +69,6 @@ void testDoFormatFileKeepLineFeedCRLF() { /** * Test is initialized. - * */ @Test void testIsInitialized() { @@ -86,7 +81,6 @@ void testIsInitialized() { /** * Test do format file with exclusions. - * */ @Test void testDoFormatFileWithExclusions() { diff --git a/src/test/java/net/revelc/code/formatter/javascript/JavascriptFormatterTest.java b/src/test/java/net/revelc/code/formatter/javascript/JavascriptFormatterTest.java index 51cd1afd..eabbdafe 100644 --- a/src/test/java/net/revelc/code/formatter/javascript/JavascriptFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/javascript/JavascriptFormatterTest.java @@ -29,7 +29,6 @@ class JavascriptFormatterTest extends AbstractFormatterTest { /** * Test do format file. - * */ @Test void testDoFormatFile() { @@ -42,7 +41,6 @@ void testDoFormatFile() { /** * Test is initialized. - * */ @Test void testIsInitialized() { diff --git a/src/test/java/net/revelc/code/formatter/json/JsonFormatterTest.java b/src/test/java/net/revelc/code/formatter/json/JsonFormatterTest.java index bee5cbd3..d777c7d6 100644 --- a/src/test/java/net/revelc/code/formatter/json/JsonFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/json/JsonFormatterTest.java @@ -36,7 +36,6 @@ class JsonFormatterTest extends AbstractFormatterTest { /** * Test do format file. - * */ @Test void testDoFormatFile() { @@ -64,7 +63,6 @@ void testIsInitialized() { /** * Test do format file with config. - * */ @Test void testDoFormatFileWithConfig() { diff --git a/src/test/java/net/revelc/code/formatter/xml/XMLFormatterTest.java b/src/test/java/net/revelc/code/formatter/xml/XMLFormatterTest.java index 40151160..8785ff84 100644 --- a/src/test/java/net/revelc/code/formatter/xml/XMLFormatterTest.java +++ b/src/test/java/net/revelc/code/formatter/xml/XMLFormatterTest.java @@ -29,7 +29,6 @@ class XMLFormatterTest extends AbstractFormatterTest { /** * Test do format file. - * */ @Test void testDoFormatFile() { @@ -45,7 +44,6 @@ void testDoFormatFile() { /** * Test is initialized. - * */ @Test void testIsInitialized() {