From 32b3cde7167e10d1dad47e660efddc7485717fac Mon Sep 17 00:00:00 2001 From: Thad Craft Date: Fri, 4 Dec 2020 09:46:42 -0500 Subject: [PATCH] Enable @SuppressWarnings annotation support by default for Java (#1052) * Enable @SuppressWarnings annotation support by default for Java checkstyle * Ensure that args is used * Add updates to the sun_checks in .github/linters * Comment out Javadoc linter to remove need for package-info * Fix expected-JAVA.tap to match new test cases * Fix expected-JAVA.tap to match output Co-authored-by: Lukas Gravley --- .automation/test/java/java_bad_2.java | 12 ++++++++++++ .automation/test/java/java_good_2.java | 13 +++++++++++++ .automation/test/java/reports/expected-JAVA.tap | 9 +++++++-- .github/linters/sun_checks.xml | 13 ++++++++----- TEMPLATES/sun_checks.xml | 13 ++++++++----- 5 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 .automation/test/java/java_bad_2.java create mode 100644 .automation/test/java/java_good_2.java diff --git a/.automation/test/java/java_bad_2.java b/.automation/test/java/java_bad_2.java new file mode 100644 index 00000000..c728c76f --- /dev/null +++ b/.automation/test/java/java_bad_2.java @@ -0,0 +1,12 @@ +public class Application { + + /** + * main. + * + * @param args + */ + public static void main(final String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/.automation/test/java/java_good_2.java b/.automation/test/java/java_good_2.java new file mode 100644 index 00000000..376cef1f --- /dev/null +++ b/.automation/test/java/java_good_2.java @@ -0,0 +1,13 @@ +@SuppressWarnings("checkstyle:hideutilityclassconstructor") +public class Application { + + /** + * main. + * + * @param args + */ + public static void main(final String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/.automation/test/java/reports/expected-JAVA.tap b/.automation/test/java/reports/expected-JAVA.tap index a6356aaf..d807bd48 100644 --- a/.automation/test/java/reports/expected-JAVA.tap +++ b/.automation/test/java/reports/expected-JAVA.tap @@ -1,7 +1,12 @@ TAP version 13 -1..2 +1..4 not ok 1 - java_bad_1.java --- message: Starting audit...\n[ERROR] /tmp/lint/.automation/test/java/java_bad_1.java 1 1 Utility classes should not have a public or default constructor. [HideUtilityClassConstructor]\n[ERROR] /tmp/lint/.automation/test/java/java_bad_1.java 1 7 Name 'java_bad_1' must match pattern '^[A-Z][a-zA-Z0-9]*$'. [TypeName]\n[ERROR] /tmp/lint/.automation/test/java/java_bad_1.java 2 1 '{' at column 1 should be on the previous line. [LeftCurly]\n[ERROR] /tmp/lint/.automation/test/java/java_bad_1.java 4 29 Parameter args should be final. [FinalParameters]\n[ERROR] /tmp/lint/.automation/test/java/java_bad_1.java 4 40 Array brackets at illegal position. [ArrayTypeStyle]\n[ERROR] /tmp/lint/.automation/test/java/java_bad_1.java 5 5 '{' at column 5 should be on the previous line. [LeftCurly]\nAudit done.\nCheckstyle ends with 6 errors.\n ... -ok 2 - java_good_1.java +not ok 2 - java_bad_2.java + --- + message: Starting audit...\n[ERROR] /tmp/lint/.automation/test/java/java_bad_2.java 1 1 Utility classes should not have a public or default constructor. [HideUtilityClassConstructor]\nAudit done.\nCheckstyle ends with 1 errors.\n + ... +ok 3 - java_good_1.java +ok 4 - java_good_2.java diff --git a/.github/linters/sun_checks.xml b/.github/linters/sun_checks.xml index 8bff099a..dd88521d 100644 --- a/.github/linters/sun_checks.xml +++ b/.github/linters/sun_checks.xml @@ -51,8 +51,7 @@ - + @@ -95,6 +94,8 @@ + + @@ -105,6 +106,8 @@ + + @@ -121,7 +124,8 @@ - + + @@ -188,8 +192,7 @@ - + diff --git a/TEMPLATES/sun_checks.xml b/TEMPLATES/sun_checks.xml index adfd1b1c..9b68056d 100644 --- a/TEMPLATES/sun_checks.xml +++ b/TEMPLATES/sun_checks.xml @@ -51,8 +51,7 @@ - + @@ -95,6 +94,8 @@ + + @@ -105,6 +106,8 @@ + + @@ -121,7 +124,8 @@ - + + @@ -188,8 +192,7 @@ - +