Skip to content

Commit

Permalink
Issue #11277: update code base to have javadoc tag to explain noinspe…
Browse files Browse the repository at this point in the history
…ction content(JUnitTestMethodWithNoAssertions, ClassIndependentOfModule, unchecked, ProhibitedExceptionThrown)
  • Loading branch information
nrmancuso committed Jun 21, 2022
1 parent 9ddc3b7 commit e8b63a1
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/puppycrawl/tools/checkstyle/Checker.java
Expand Up @@ -273,6 +273,8 @@ private void fireAuditFinished() {
* @throws CheckstyleException if error condition within Checkstyle occurs.
* @throws Error wraps any java.lang.Error happened during execution
* @noinspection ProhibitedExceptionThrown
* @noinspectionreason ProhibitedExceptionThrown - There is no other way to
* deliver filename that was under processing.
*/
// -@cs[CyclomaticComplexity] no easy way to split this logic of processing the file
private void processFiles(List<File> files) throws CheckstyleException {
Expand Down
Expand Up @@ -38,7 +38,10 @@
* This is similar to multi-file validation, which checkstyle does not support fully yet.
* Please refer to https://github.com/checkstyle/checkstyle/issues/3540 for details.
*
* @noinspection AnnotationClass, ClassIndependentOfModule, unused, ClassOnlyUsedInOnePackage
* @noinspection AnnotationClass, ClassIndependentOfModule, ClassOnlyUsedInOnePackage
* @noinspectionreason AnnotationClass - we support only Java 11+
* @noinspectionreason ClassIndependentOfModule - we keep this annotation at top level by design
* @noinspectionreason ClassOnlyUsedInOnePackage - checks live in one package by design
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
Expand Down
Expand Up @@ -49,6 +49,9 @@
* so they can use them in their configuration gui.
*
* @noinspection UseOfSystemOutOrSystemErr, unused, ClassIndependentOfModule
* @noinspectionreason UseOfSystemOutOrSystemErr - used for CLI output
* @noinspectionreason unused - main method is "unused" in code since it is driver method
* @noinspectionreason ClassIndependentOfModule - architecture of package requires this
*/
public final class JavadocPropertiesGenerator {

Expand Down
Expand Up @@ -34,6 +34,8 @@
* This also means, that all files will be processed by the same check instance.
*
* @noinspection AnnotationClass, ClassIndependentOfModule
* @noinspectionreason AnnotationClass - we support only Java 11+
* @noinspectionreason ClassIndependentOfModule - we keep this annotation at top level by design
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
Expand Down
Expand Up @@ -49,6 +49,7 @@ public static void validateGraphicsEnvironment() {
* @param <T> the type of component to find
* @return the component if found, {@code null} otherwise
* @noinspection unchecked
* @noinspectionreason unchecked - we know that any component is OK to typecast to T
*/
protected static <T extends Component> T findComponentByName(Component root, String name) {
Component result = null;
Expand Down
Expand Up @@ -33,6 +33,8 @@
* GeneratedJavaTokenTypesTest.
*
* @noinspection ClassIndependentOfModule
* @noinspectionreason ClassIndependentOfModule - architecture of test modules
* requires this structure
*/
public class GeneratedJavaTokenTypesTest {

Expand Down
Expand Up @@ -31,6 +31,8 @@
* GeneratedJavadocTokenTypesTest.
*
* @noinspection ClassIndependentOfModule
* @noinspectionreason ClassIndependentOfModule - architecture of test modules
* requires this structure
*/
public class GeneratedJavadocTokenTypesTest {

Expand Down
Expand Up @@ -40,6 +40,8 @@
* AllTestsTest.
*
* @noinspection ClassIndependentOfModule
* @noinspectionreason ClassIndependentOfModule - architecture of
* test modules requires this structure
*/
public class AllTestsTest {

Expand Down
Expand Up @@ -43,9 +43,10 @@ public static void init() {
* except for those which are annotated with {@code Override}. In the bytecode there is no
* trace anymore if this method was annotated with {@code Override} or not (limitation of
* Archunit), eventually we need to make checkstyle's Check on this.
* Test contains assertions in the callstack, but TeamCity inspection does not see them.
*
* @noinspection JUnitTestMethodWithNoAssertions
* @noinspectionreason JUnitTestMethodWithNoAssertions - asserts in callstack,
* but not in this method
*/
@Test
public void nonProtectedCheckMethodsTest() {
Expand Down
Expand Up @@ -133,9 +133,11 @@ public void setUp() throws Exception {
}

/**
* Test contains asserts in callstack, but idea does not see them.
* Validates check javadocs and xdocs for consistency.
*
* @noinspection JUnitTestMethodWithNoAssertions
* @noinspectionreason JUnitTestMethodWithNoAssertions - asserts in callstack,
* but not in this method
*/
@Test
public void testAllCheckSectionJavaDocs() throws Exception {
Expand Down
Expand Up @@ -505,9 +505,11 @@ public void testAllCheckSections() throws Exception {
}

/**
* Test contains asserts in callstack, but idea does not see them.
* Validates xml check documentation section.
*
* @noinspection JUnitTestMethodWithNoAssertions
* @noinspectionreason JUnitTestMethodWithNoAssertions -asserts in callstack,
* but not in this method
*/
@Test
public void testAllCheckSectionsEx() throws Exception {
Expand Down

0 comments on commit e8b63a1

Please sign in to comment.