Skip to content

Commit

Permalink
Batch rename sample files (#4738)
Browse files Browse the repository at this point in the history
Rename most sample of: AWS, A.*, [B-T].*.
  • Loading branch information
johann-beleites-sonarsource authored Apr 19, 2024
1 parent 9463c91 commit 4882bc0
Show file tree
Hide file tree
Showing 781 changed files with 1,583 additions and 1,583 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AwsConsumerBuilderUsageCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsConsumerBuilderUsageCheck.java"))
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsConsumerBuilderUsageCheckSample.java"))
.withCheck(new AwsConsumerBuilderUsageCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand All @@ -41,7 +41,7 @@ void test() {
@Test
void non_compiling() {
CheckVerifier.newVerifier()
.onFile(nonCompilingTestSourcesPathInModule(AWS_MODULE, "checks/aws/AwsConsumerBuilderUsageCheck.java"))
.onFile(nonCompilingTestSourcesPathInModule(AWS_MODULE, "checks/aws/AwsConsumerBuilderUsageCheckSample.java"))
.withCheck(new AwsConsumerBuilderUsageCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AwsCredentialsShouldBeSetExplicitlyCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsCredentialsShouldBeSetExplicitlyCheck.java"))
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsCredentialsShouldBeSetExplicitlyCheckSample.java"))
.withCheck(new AwsCredentialsShouldBeSetExplicitlyCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AwsLambdaSyncCallCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsLambdaSyncCallCheck.java"))
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsLambdaSyncCallCheckSample.java"))
.withCheck(new AwsLambdaSyncCallCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AwsLongTermAccessKeysCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsLongTermAccessKeysCheck.java"))
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsLongTermAccessKeysCheckSample.java"))
.withCheck(new AwsLongTermAccessKeysCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AwsRegionSetterCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsRegionSetterCheck.java"))
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsRegionSetterCheckSample.java"))
.withCheck(new AwsRegionSetterCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AwsRegionShouldBeSetExplicitlyCheckTest {
void test() {
CheckVerifier.newVerifier()
.withCheck(new AwsRegionShouldBeSetExplicitlyCheck())
.onFiles(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsRegionShouldBeSetExplicitlyCheck.java"))
.onFiles(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsRegionShouldBeSetExplicitlyCheckSample.java"))
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AwsReusableResourcesInitializedOnceCheckTest {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsReusableResourcesInitializedOnceCheck.java"))
.onFile(mainCodeSourcesPathInModule(AWS_MODULE, "checks/aws/AwsReusableResourcesInitializedOnceCheckSample.java"))
.withCheck(new AwsReusableResourcesInitializedOnceCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void uses_empty_collection_when_methods_cannot_be_loaded() {
@Test
void test() {
CheckVerifier.newVerifier()
.onFile(TestUtils.mainCodeSourcesPathInModule(AWS_MODULE, "checks/security/HardCodedCredentialsShouldNotBeUsedCheck.java"))
.onFile(TestUtils.mainCodeSourcesPathInModule(AWS_MODULE, "checks/security/HardCodedCredentialsShouldNotBeUsedCheckSample.java"))
.withCheck(new HardCodedCredentialsShouldNotBeUsedCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand All @@ -61,7 +61,7 @@ void test() {
@Test
void test_non_compiling_code() {
CheckVerifier.newVerifier()
.onFile(TestUtils.nonCompilingTestSourcesPath("checks/security/HardCodedCredentialsShouldNotBeUsedCheck.java"))
.onFile(TestUtils.nonCompilingTestSourcesPath("checks/security/HardCodedCredentialsShouldNotBeUsedCheckSample.java"))
.withCheck(new HardCodedCredentialsShouldNotBeUsedCheck())
.withClassPath(AWS_CLASSPATH)
.verifyIssues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
import java.util.function.Consumer;
import software.amazon.awssdk.services.sesv2.model.Destination;

public class AwsConsumerBuilderUsageCheck {
public class AwsConsumerBuilderUsageCheckSample {

public void test() {
AwsConsumerBuilderUsageCheck.builder()
AwsConsumerBuilderUsageCheckSample.builder()
.validDestination(Destination.builder() // Noncompliant [[sc=8;ec=24]] {{Consider using the Consumer Builder method instead of creating this nested builder.}}
.toAddresses("[email protected]")
.bccAddresses("[email protected]")
.build())
.build();

AwsConsumerBuilderUsageCheck.builder()
AwsConsumerBuilderUsageCheckSample.builder()
.validDestination("Not a Destination object") // Compliant, wrong argument type
.build();

AwsConsumerBuilderUsageCheck.builder()
AwsConsumerBuilderUsageCheckSample.builder()
.validDestination(new UnknownType()) // Compliant, unknown argument type
.build();

AwsConsumerBuilderUsageCheck.builder()
AwsConsumerBuilderUsageCheckSample.builder()
.testUnknownReturnType(Destination.builder() // Compliant, unknown return type
.toAddresses("[email protected]")
.bccAddresses("[email protected]")
.build())
.build();

AwsConsumerBuilderUsageCheck.builder()
AwsConsumerBuilderUsageCheckSample.builder()
.testInvalidConsumerType(Destination.builder() // Compliant, unknown return type
.toAddresses("[email protected]")
.bccAddresses("[email protected]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import software.amazon.awssdk.services.sesv2.model.Message;
import software.amazon.awssdk.services.sesv2.model.SendEmailRequest;

public class AwsConsumerBuilderUsageCheck {
public class AwsConsumerBuilderUsageCheckSample {

Destination destinationField = Destination.builder()
.toAddresses("[email protected]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.S3ClientBuilder;

public class AwsCredentialsShouldBeSetExplicitlyCheck {
public class AwsCredentialsShouldBeSetExplicitlyCheckSample {
public static final AwsClientBuilder BUILDER = S3Client.builder(); // Compliant FN - Could be configured closer to build call

void nonCompliant() {
Expand Down Expand Up @@ -40,13 +40,13 @@ void compliant(AwsClientBuilder builderArgument) {
AwsClientBuilder locallyCraftedBuilder = getABuilder(); // Compliant FN
S3Client otherClient = (S3Client) locallyCraftedBuilder.build();

AwsClientBuilder remotelyCraftedBuilder = AwsRegionShouldBeSetExplicitlyCheck.getABuilder(); // Compliant FN
AwsClientBuilder remotelyCraftedBuilder = AwsRegionShouldBeSetExplicitlyCheckSample.getABuilder(); // Compliant FN
S3Client yetAnotherClient = (S3Client) remotelyCraftedBuilder.build();

AwsClientBuilder remotelyPreCraftedBuilder = AwsRegionShouldBeSetExplicitlyCheck.BUILDER; // Compliant FN
AwsClientBuilder remotelyPreCraftedBuilder = AwsRegionShouldBeSetExplicitlyCheckSample.BUILDER; // Compliant FN
S3Client stillAnotherClient = (S3Client) remotelyPreCraftedBuilder.build();

S3Client sourceDirectlyFromBuilder = (S3Client) AwsRegionShouldBeSetExplicitlyCheck.BUILDER.build(); // Compliant FN
S3Client sourceDirectlyFromBuilder = (S3Client) AwsRegionShouldBeSetExplicitlyCheckSample.BUILDER.build(); // Compliant FN

S3Client clientOutOfNowhere = (S3Client) BUILDER.build(); // Compliant FN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import static checks.aws.AwsLambdaSyncCallCheckHelper.REQUEST_IN_DIFFERENT_FILE;

public class AwsLambdaSyncCallCheck {
public class AwsLambdaSyncCallCheckSample {

public static final String MY_FUNCTION = "myFunction";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.auth.BasicSessionCredentials;

public class AwsLongTermAccessKeysCheck {
public class AwsLongTermAccessKeysCheckSample {
void noncompliant() {
BasicAWSCredentials foo = new BasicAWSCredentials("", ""); // Noncompliant [[sc=35;ec=54]] {{Make sure using a long-term access key is safe here.}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.amazonaws.services.lambda.AWSLambdaClientBuilder;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;

public class AwsRegionSetterCheck {
public class AwsRegionSetterCheckSample {

public static final String CONST = "const";
private static final String EU_WEST_1 = "EU_WEST_1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.S3ClientBuilder;

public class AwsRegionShouldBeSetExplicitlyCheck {
public class AwsRegionShouldBeSetExplicitlyCheckSample {
public static final AwsClientBuilder BUILDER = getABuilder();

void nonCompliantChained() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import software.amazon.awssdk.services.machinelearning.MachineLearningClient;
import software.amazon.awssdk.services.s3.S3Client;

public class AwsReusableResourcesInitializedOnceCheck {
public class AwsReusableResourcesInitializedOnceCheckSample {

class RequestHandlerImpl implements RequestHandler<Object, Void> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import static java.lang.System.getProperty;

public class HardCodedCredentialsShouldNotBeUsedCheck {
public class HardCodedCredentialsShouldNotBeUsedCheckSample {
static final String FINAL_SECRET_STRING = "hunter2";
static final byte[] FINAL_SECRET_BYTE_ARRAY = FINAL_SECRET_STRING.getBytes(StandardCharsets.UTF_8);
private static String secretStringField = "hunter2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.lang.reflect.Field;

class AccessibilityChangeCheck {
class AccessibilityChangeCheckSample {
record Person(String name, int age) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
String myName() default "myName";
int myInteger() default 0;
}
class AnnotationDefaultArgumentCheck {
class AnnotationDefaultArgumentCheckSample {

@MyUnknownAnnotation("value")
void unknownAnnotation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ArrayForVarArgCheckBar {}
class ArrayForVarArgCheckFoo extends ArrayForVarArgCheckBar {}
class ArrayForVarArgCheck {
class ArrayForVarArgCheckSample {

public void callTheThing(String s) {
ArrayForVarArgCheckFoo foo = new ArrayForVarArgCheckFoo();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AtLeastOneConstructorCheck {
class AtLeastOneConstructorCheckSample {
@EJB
private MyObject foo; // Compliant, unknown annotation, could be from javax.ejb.
@Resource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

class BooleanMethodReturnCheckA {
class BooleanMethodReturnCheckSampleA {
@UnknownAnnotation
public Boolean foo() {
return null; // Compliant, UnknownAnnotation could be Nullable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

abstract class DeadStoreCheck {
abstract class DeadStoreCheckSample {

void lambdas_not_resolved(UnknnownFunction lambda) {
int a = 42; // Compliant
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

class DoubleCheckedLockingCheck {
class DoubleCheckedLockingCheckSample {

private UnknownType unknownType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

class EqualsNotOverriddenInSubclassCheck {
class EqualsNotOverriddenInSubclassCheckSample {

class A {
public boolean equals(Object obj) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

class FinalizeFieldsSetCheck {
class FinalizeFieldsSetCheckSample {
Integer myInteger;

private boolean myMethod() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import scala.reflect.ManifestFactory.IntManifest;

class ForLoopIncrementAndUpdateCheck {
class ForLoopIncrementAndUpdateCheckSample {

Object foo() {
int i = 0, j = 0, k = 0, l = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//Type is missing: import java.lang.reflect.Constructor;

class ForLoopVariableTypeCheck {
class ForLoopVariableTypeCheckSample {

private static <T> void f(Class<T> c) {
for (Constructor<?> ctor : c.getConstructors()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.sql.SQLException;
import javax.naming.Context;

class HardCodedPasswordCheck {
class HardCodedPasswordCheckSample {

private void a(char[] pwd, String var) throws SQLException {
MyUnknownClass.myUnknownMethod("password", "xxxxx"); // Noncompliant
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

class IdenticalCasesInSwitchCheck {
class IdenticalCasesInSwitchCheckSample {
void foo(WeekendDay weekendDay){
int i = switch (weekendDay) {
case SATURDAY:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

abstract class ImmediateReverseBoxingCheck {
abstract class ImmediateReverseBoxingCheckSample {
void intBoxingAndUnboxing(int int1, Integer integer1, String string, Double double1) {
int int2 = new Integer(1); // Noncompliant
Integer.valueOf(double1); // Compliant
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package checks;

class ImmediatelyReturnedVariableCheck {
class ImmediatelyReturnedVariableCheckSample {

Object emptyInitializer() {
// Does not compile (variable o not initialized), but the rule should not raise an Exception anyway.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Log {
void log(Level level, String s, Exception e);
}

public class InterruptedExceptionCheck {
public class InterruptedExceptionCheckSample {
static final Log LOGGER = null;

public void run1 () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package java.lang;

public class IsInstanceMethodCheck {
public class IsInstanceMethodCheckSample {

int compliant(Number n) {
if (n instanceof String) { // Compile-time error
Expand Down
Loading

0 comments on commit 4882bc0

Please sign in to comment.