diff --git a/build-tools/src/main/java/software/amazon/awssdk/buildtools/checkstyle/NoIgnoreAnnotationsCheck.java b/build-tools/src/main/java/software/amazon/awssdk/buildtools/checkstyle/NoIgnoreAnnotationsCheck.java new file mode 100644 index 000000000000..d05f9d4b66c6 --- /dev/null +++ b/build-tools/src/main/java/software/amazon/awssdk/buildtools/checkstyle/NoIgnoreAnnotationsCheck.java @@ -0,0 +1,57 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package software.amazon.awssdk.buildtools.checkstyle; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.AnnotationUtil; + +/** + * Checks if a class uses the @Ignore annotation. Avoid disabling tests and work to + * resolve issues with the test instead. + * + * For manual tests and exceptional circumstances, use the commentation feature CHECKSTYLE: OFF + * to mark a test as ignored. + */ +public class NoIgnoreAnnotationsCheck extends AbstractCheck { + + private static final String IGNORE_ANNOTATION = "Ignore"; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] {TokenTypes.CLASS_DEF, TokenTypes.METHOD_DEF}; + } + + @Override + public void visitToken(DetailAST ast) { + if (!AnnotationUtil.containsAnnotation(ast, IGNORE_ANNOTATION)) { + return; + } + + log(ast, "@Ignore annotation is not allowed"); + } +} diff --git a/build-tools/src/main/resources/software/amazon/awssdk/checkstyle-suppressions.xml b/build-tools/src/main/resources/software/amazon/awssdk/checkstyle-suppressions.xml index ff4c7d221c32..abcae3b3cacd 100644 --- a/build-tools/src/main/resources/software/amazon/awssdk/checkstyle-suppressions.xml +++ b/build-tools/src/main/resources/software/amazon/awssdk/checkstyle-suppressions.xml @@ -16,17 +16,13 @@ --> + "-//Puppy Crawl//DTD Suppressions 1.2//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_2.dtd"> - - + - - - diff --git a/build-tools/src/main/resources/software/amazon/awssdk/checkstyle.xml b/build-tools/src/main/resources/software/amazon/awssdk/checkstyle.xml index 52e0d8725d18..e06660009921 100644 --- a/build-tools/src/main/resources/software/amazon/awssdk/checkstyle.xml +++ b/build-tools/src/main/resources/software/amazon/awssdk/checkstyle.xml @@ -384,7 +384,6 @@ - @@ -401,6 +400,10 @@ + + + + diff --git a/core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/ExecutionInterceptor.java b/core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/ExecutionInterceptor.java index ef4df9622e3e..dd18725b6dea 100644 --- a/core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/ExecutionInterceptor.java +++ b/core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/ExecutionInterceptor.java @@ -23,8 +23,8 @@ import software.amazon.awssdk.core.SdkRequest; import software.amazon.awssdk.core.SdkResponse; import software.amazon.awssdk.core.async.AsyncRequestBody; -// Disable CS to avoid "Unused Import" error. If we use the FQCN in the Javadoc, we'll run into line length issues instead. -// CHECKSTYLE:OFF + +// CHECKSTYLE:OFF - Avoid "Unused Import" error. If we use the FQCN in the Javadoc, we'll run into line length issues instead. import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; // CHECKSTYLE:ON import software.amazon.awssdk.core.retry.RetryPolicy; diff --git a/pom.xml b/pom.xml index 3259d543f379..646fd982121f 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,7 @@ 1.0.3 ${skipTests} + ${project.basedir}/src/it/java @@ -422,6 +423,8 @@ true true true + ${project.build.testSourceDirectory},${integTestSourceDirectory} + true true **/module-info.java diff --git a/services/sqs/src/it/java/software/amazon/awssdk/services/sqs/SqsConcurrentPerformanceIntegrationTest.java b/services/sqs/src/it/java/software/amazon/awssdk/services/sqs/SqsConcurrentPerformanceIntegrationTest.java index 605adab6a221..b09e8d469612 100644 --- a/services/sqs/src/it/java/software/amazon/awssdk/services/sqs/SqsConcurrentPerformanceIntegrationTest.java +++ b/services/sqs/src/it/java/software/amazon/awssdk/services/sqs/SqsConcurrentPerformanceIntegrationTest.java @@ -45,8 +45,10 @@ public class SqsConcurrentPerformanceIntegrationTest extends IntegrationTestBase * You can use the netstat command to look at the current sockets connected to SQS and verify * that they don't sit around in CLOSE_WAIT, and are correctly being reaped. */ + // CHECKSTYLE:OFF - Allowing @Ignore for this manual test @Test @Ignore + // CHECKSTYLE:ON public void testIdleConnectionReaping() throws Exception { sqs = SqsAsyncClient.builder().credentialsProvider(getCredentialsProvider()).build(); sqs = SqsAsyncClient.builder().credentialsProvider(getCredentialsProvider()).build(); @@ -79,4 +81,4 @@ public void run() { private void waitForUserInput() throws IOException { new BufferedReader(new InputStreamReader(System.in)).readLine(); } -} +} \ No newline at end of file diff --git a/utils/src/main/java/software/amazon/awssdk/utils/UserHomeDirectoryUtils.java b/utils/src/main/java/software/amazon/awssdk/utils/UserHomeDirectoryUtils.java index d5155023e9a4..a2a3b53d09b8 100644 --- a/utils/src/main/java/software/amazon/awssdk/utils/UserHomeDirectoryUtils.java +++ b/utils/src/main/java/software/amazon/awssdk/utils/UserHomeDirectoryUtils.java @@ -30,8 +30,7 @@ private UserHomeDirectoryUtils() { } public static String userHomeDirectory() { - // To match the logic of the CLI we have to consult environment variables directly. - // CHECKSTYLE:OFF + // CHECKSTYLE:OFF - To match the logic of the CLI we have to consult environment variables directly. Optional home = SystemSetting.getStringValueFromEnvironmentVariable("HOME"); if (home.isPresent()) {