mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-25 14:12:14 -05:00
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 <admiralawkbar@github.com>
This commit is contained in:
parent
30d4aa6743
commit
32b3cde716
5 changed files with 48 additions and 12 deletions
12
.automation/test/java/java_bad_2.java
Normal file
12
.automation/test/java/java_bad_2.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
public class Application {
|
||||
|
||||
/**
|
||||
* main.
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
}
|
13
.automation/test/java/java_good_2.java
Normal file
13
.automation/test/java/java_good_2.java
Normal file
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
13
.github/linters/sun_checks.xml
vendored
13
.github/linters/sun_checks.xml
vendored
|
@ -51,8 +51,7 @@
|
|||
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
|
||||
default="checkstyle-suppressions.xml" />
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" default="checkstyle-suppressions.xml" />
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
|
@ -95,6 +94,8 @@
|
|||
<!-- <property name="fileExtensions" value="java"/> -->
|
||||
<!-- </module> -->
|
||||
|
||||
<!-- Enables @SuppressWarnings Support -->
|
||||
<module name="SuppressWarningsFilter"/>
|
||||
<module name="TreeWalker">
|
||||
|
||||
<!-- Checks for Javadoc comments. -->
|
||||
|
@ -105,6 +106,8 @@
|
|||
<module name="JavadocVariable"/>
|
||||
<module name="JavadocStyle"/>
|
||||
<module name="MissingJavadocMethod"/>
|
||||
<!-- Enables @SuppressWarnings Support -->
|
||||
<module name="SuppressWarningsHolder"/>
|
||||
|
||||
<!-- Checks for Naming Conventions. -->
|
||||
<!-- See https://checkstyle.org/config_naming.html -->
|
||||
|
@ -121,7 +124,8 @@
|
|||
<!-- Checks for imports -->
|
||||
<!-- See https://checkstyle.org/config_imports.html -->
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
||||
<module name="IllegalImport"/>
|
||||
<!-- defaults to sun.* packages -->
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="false"/>
|
||||
|
@ -188,8 +192,7 @@
|
|||
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
|
||||
<module name="SuppressionXpathFilter">
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
|
||||
default="checkstyle-xpath-suppressions.xml" />
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" default="checkstyle-xpath-suppressions.xml" />
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@
|
|||
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
|
||||
default="checkstyle-suppressions.xml" />
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" default="checkstyle-suppressions.xml" />
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
|
@ -95,6 +94,8 @@
|
|||
<!-- <property name="fileExtensions" value="java"/> -->
|
||||
<!-- </module> -->
|
||||
|
||||
<!-- Enables @SuppressWarnings Support -->
|
||||
<module name="SuppressWarningsFilter"/>
|
||||
<module name="TreeWalker">
|
||||
|
||||
<!-- Checks for Javadoc comments. -->
|
||||
|
@ -105,6 +106,8 @@
|
|||
<module name="JavadocVariable"/>
|
||||
<module name="JavadocStyle"/>
|
||||
<module name="MissingJavadocMethod"/>
|
||||
<!-- Enables @SuppressWarnings Support -->
|
||||
<module name="SuppressWarningsHolder"/>
|
||||
|
||||
<!-- Checks for Naming Conventions. -->
|
||||
<!-- See https://checkstyle.org/config_naming.html -->
|
||||
|
@ -121,7 +124,8 @@
|
|||
<!-- Checks for imports -->
|
||||
<!-- See https://checkstyle.org/config_imports.html -->
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
||||
<module name="IllegalImport"/>
|
||||
<!-- defaults to sun.* packages -->
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="false"/>
|
||||
|
@ -188,8 +192,7 @@
|
|||
|
||||
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
|
||||
<module name="SuppressionXpathFilter">
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
|
||||
default="checkstyle-xpath-suppressions.xml" />
|
||||
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" default="checkstyle-xpath-suppressions.xml" />
|
||||
<property name="optional" value="true"/>
|
||||
</module>
|
||||
|
||||
|
|
Loading…
Reference in a new issue