diff --git a/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/MetricsTest.java b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/MetricsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..11347169597774577e49737d6ad4b411080779c2 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/MetricsTest.java @@ -0,0 +1,75 @@ +package com.huawei.devkit.code.inspector; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +public class MetricsTest { + @Test + void testBooleanExpressionComplexity() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/metrics/BooleanExpressionComplexityCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/metrics/BooleanExpressionComplexity.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testBooleanExpressionComplexity.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testClassDataAbstractionCouplingCase() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/metrics/ClassDataAbstractionCouplingCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/metrics/ClassDataAbstractionCoupling.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testClassDataAbstractionCoupling.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + + @Test + void testClassFanOutComplexityCase() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/metrics/ClassFanOutComplexityCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/metrics/ClassFanOutComplexity.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testClassFanOutComplexity.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testCyclomaticComplexityCase() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/metrics/CyclomaticComplexityCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/metrics/CyclomaticComplexity.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testCyclomaticComplexity.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testJavaNCSSCase() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/metrics/JavaNCSSCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/metrics/JavaNCSS.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testJavaNCSSCase.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testNPathComplexity() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/metrics/NPathComplexityCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/metrics/NPathComplexity.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testNPathComplexity.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } +} diff --git a/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/MiscellaneousTest.java b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/MiscellaneousTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9096945fbf332e2715599208dbdd5ce319b37d5c --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/MiscellaneousTest.java @@ -0,0 +1,121 @@ +package com.huawei.devkit.code.inspector; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +public class MiscellaneousTest { + + @Test + void testArrayTypeStyle() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/ArrayTypeStyleCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/ArrayTypeStyle.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testArrayTypeStyle.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testAvoidEscapedUnicodeCharacters() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/AvoidEscapedUnicodeCharactersCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/AvoidEscapedUnicodeCharacters.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testAvoidEscapedUnicodeCharacters.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testCommentsIndentation() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/CommentsIndentationCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/CommentsIndentation.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testCommentsIndentation.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testDescendantToken() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/DescendantTokenCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/DescendantToken.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testDescendantToken.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testIndentation() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/IndentationCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/Indentation.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testIndentation.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testNewlineAtEndOfFile() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/NewlineAtEndOfFileCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/NewlineAtEndOfFile.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testNewlineAtEndOfFile.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testNoCodeInFile() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/NoCodeInFileCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/NoCodeInFile.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testNoCodeInFile.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testOuterTypeFilename() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/OuterTypeFilenameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/OuterTypeFilename.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testOuterTypeFilename.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testTodoComment() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/TodoCommentCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/TodoComment.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testTodoComment.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testUpperEll() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/miscellaneous/UpperEllCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/miscellaneous/UpperEll.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testUpperEll.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + +} diff --git a/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/ModifiersTest.java b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/ModifiersTest.java new file mode 100644 index 0000000000000000000000000000000000000000..364dd91ad5da6dad0fe28d0311237d90d7ef5448 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/ModifiersTest.java @@ -0,0 +1,30 @@ +package com.huawei.devkit.code.inspector; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +public class ModifiersTest { + @Test + void testModifierOrder() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/modifiers/ModifierOrderCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/modifiers/ModifierOrder.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testModifierOrder.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testRedundantModifier() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/modifiers/RedundantModifierCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/modifiers/RedundantModifier.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testRedundantModifier.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } +} diff --git a/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/NamingConventionsTest.java b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/NamingConventionsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..28ea2bd5b6626e6810f82c7807c1b69e2e5735f6 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/java/com/huawei/devkit/code/inspector/NamingConventionsTest.java @@ -0,0 +1,198 @@ +package com.huawei.devkit.code.inspector; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +public class NamingConventionsTest { + + @Test + void testRedundantModifier() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/AbbreviationAsWordInNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/AbbreviationAsWordInName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testAbbreviationAsWordInName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testClassTypeParameterName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/ClassTypeParameterNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/ClassTypeParameterName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testClassTypeParameterName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testConstantName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/ConstantNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/ConstantName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testConstantName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testIllegalIdentifierName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/IllegalIdentifierNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/IllegalIdentifierName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testIllegalIdentifierName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testInterfaceTypeParameterName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/InterfaceTypeParameterNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/InterfaceTypeParameterName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testInterfaceTypeParameterName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testLocalFinalVariableName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/LocalFinalVariableNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/LocalFinalVariableName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testLocalFinalVariableName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testLocalVariableName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/LocalVariableNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/LocalVariableName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testLocalVariableName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testMemberName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/MemberNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/MemberName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testMemberName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testMethodName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/MethodNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/MethodName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testMethodName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testMethodTypeParameterName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/MethodTypeParameterNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/MethodTypeParameterName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testMethodTypeParameterName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testPackageName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/PackageNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/PackageName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testPackageName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testParameterName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/ParameterNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/ParameterName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testParameterName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testPatternVariableName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/PatternVariableNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/PatternVariableName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testPatternVariableName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testRecordComponentName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/RecordComponentNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/RecordComponentName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testRecordComponentName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testRecordTypeParameterName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/RecordTypeParameterNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/RecordTypeParameterName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testRecordTypeParameterName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testStaticVariableName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/StaticVariableNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/StaticVariableName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testStaticVariableName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + @Test + void testTypeName() { + String root = System.getProperty("user.dir"); + String filePath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("case/naming_conventions/TypeNameCase.java")).getPath(); + String configPath = Objects.requireNonNull(this.getClass().getClassLoader() + .getResource("single_rules/naming_conventions/TypeName.xml")).getPath(); + String[] args = new String[]{"-c", configPath, "-o", root + "/testTypeName.out", "-f", "sarif", filePath}; + Assertions.assertDoesNotThrow(() -> CodeInspector.main(args)); + } + + +} diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/metrics/BooleanExpressionComplexityCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/BooleanExpressionComplexityCase.java new file mode 100644 index 0000000000000000000000000000000000000000..eacc9e4672d8eb871db9f3e1ebe85388f3aba0a3 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/BooleanExpressionComplexityCase.java @@ -0,0 +1,17 @@ +public class BooleanExpressionComplexityCase +{ + public static void main(String ... args) + { + boolean a = true; + boolean b = false; + + boolean c = (a & b) | (b ^ a); // OK, 1(&) + 1(|) + 1(^) = 3 (max allowed 5) + + boolean d = (a & b) | (b ^ a) | (a ^ b); + // OK above, 1(&) + 1(|) + 1(^) + 1(|) + 1(^) = 5 + + boolean e = a ^ (a || b) ^ (b || a) & (a | b); + // violation above, 'Boolean expression complexity is 6 (max allowed is 5)' + // 1(^) + 1(||) + 1(^) + 1(||) + 1(&) + 1(|) = 6 + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/metrics/ClassDataAbstractionCouplingCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/ClassDataAbstractionCouplingCase.java new file mode 100644 index 0000000000000000000000000000000000000000..2adba87b44f475cb4507adaaddca478eb0754ec1 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/ClassDataAbstractionCouplingCase.java @@ -0,0 +1,7 @@ +public class ClassDataAbstractionCouplingCase { + Set set = new HashSet(); // HashSet ignored due to default excludedClasses property + Map map = new HashMap(); // HashMap ignored due to default excludedClasses property + Date date = new Date(); // Counted, 1 + Time time = new Time(); // Counted, 2 + Place place = new Place(); // Counted, 3 +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/metrics/ClassFanOutComplexityCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/ClassFanOutComplexityCase.java new file mode 100644 index 0000000000000000000000000000000000000000..0ddf1f559089d042e045cd9c60dc92ca66b85efb --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/ClassFanOutComplexityCase.java @@ -0,0 +1,18 @@ +import java.sql.Time; + +public class ClassFanOutComplexityCase { + Set set = new HashSet(); // Set, HashSet ignored due to default excludedClasses property + Map map = new HashMap(); // Map, HashMap ignored due to default excludedClasses property + Date date = new Date(); // Counted, 1 + Time time = new Time(); // Counted, 2 + Place place = new Place(); // Counted, 3 + int value = 10; // int is ignored due to default excludedClasses property + + void method() { + var result = "result"; // var is ignored due to default excludedClasses property + } + + public void setTime() { + Time time1 = new Time(); + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/metrics/CyclomaticComplexityCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/CyclomaticComplexityCase.java new file mode 100644 index 0000000000000000000000000000000000000000..700d33eb450a2ce12aea5c24a682b3deb75b916b --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/CyclomaticComplexityCase.java @@ -0,0 +1,35 @@ +public class CyclomaticComplexityCase +{ + // Cyclomatic Complexity = 11 + int a, b, c, d, n; + public void foo() { // 1, function declaration + if (a == 1) { // 2, if + fun1(); + } else if (a == b // 3, if + && a == c) { // 4, && operator + if (c == 2) { // 5, if + fun2(); + } + } else if (a == d) { // 6, if + try { + fun4(); + } catch (Exception e) { // 7, catch + } + } else { + switch(n) { + case 1: // 8, case + fun1(); + break; + case 2: // 9, case + fun2(); + break; + case 3: // 10, case + fun3(); + break; + default: + break; + } + } + d = a < 0 ? -1 : 1; // 11, ternary operator + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/metrics/JavaNCSSCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/JavaNCSSCase.java new file mode 100644 index 0000000000000000000000000000000000000000..f80877a6e07eaab0bce895d1b14ff30cd9744d52 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/JavaNCSSCase.java @@ -0,0 +1,56 @@ +public class JavaNCSSCase { + public static void main(String[] args) { + System.out.println("Line 1"); + System.out.println("Line 2"); + System.out.println("Line 3"); + System.out.println("Line 4"); + System.out.println("Line 5"); + System.out.println("Line 6"); + // it's line 7 + System.out.println("Line 7"); + System.out.println("Line 8"); + System.out.println("Line 9"); + System.out.println("Line 10"); + System.out.println("Line 11"); + System.out.println("Line 12"); + System.out.println("Line 13"); + System.out.println("Line 14"); + System.out.println("Line 15"); + System.out.println("Line 16"); + System.out.println("Line 17"); + System.out.println("Line 18"); + System.out.println("Line 19"); + System.out.println("Line 20"); + System.out.println("Line 21"); + System.out.println("Line 22"); + System.out.println("Line 23"); + System.out.println("Line 24"); + System.out.println("Line 25"); + System.out.println("Line 26"); + System.out.println("Line 27"); + System.out.println("Line 28"); + System.out.println("Line 29"); + System.out.println("Line 30"); + System.out.println("Line 31"); + System.out.println("Line 32"); + System.out.println("Line 33"); + System.out.println("Line 34"); + System.out.println("Line 35"); + System.out.println("Line 36"); + System.out.println("Line 37"); + System.out.println("Line 38"); + System.out.println("Line 39"); + System.out.println("Line 40"); + System.out.println("Line 41"); + System.out.println("Line 42"); + System.out.println("Line 43"); + System.out.println("Line 44"); + System.out.println("Line 45"); + System.out.println("Line 46"); + System.out.println("Line 47"); + System.out.println("Line 48"); + System.out.println("Line 49"); + System.out.println("Line 50"); // OK + System.out.println("Line 51"); // violation, the method crosses 50 non commented lines + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/metrics/NPathComplexityCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/NPathComplexityCase.java new file mode 100644 index 0000000000000000000000000000000000000000..5125b238ae78b4e338e799444236fe006dfeeb95 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/metrics/NPathComplexityCase.java @@ -0,0 +1,54 @@ +public class NPathComplexityCase { + + final int a = 0; + int b = 0; + + public void foo() { // OK, NPath complexity is less than default threshold + // function consists of one if-else block with an NPath Complexity of 3 + if (a > 10) { + if (a > b) { // nested if-else decision tree adds 2 to the complexity count + buzz(); + } else { + fizz(); + } + } else { // last possible outcome of the main if-else block, adds 1 to complexity + buzz(); + } + } + + public void boo() { // violation, NPath complexity is 217 (max allowed is 200) + // looping through 3 switch statements produces 6^3 + 1 (217) possible outcomes + for (int i = 0; i < b; i++) { // for statement adds 1 to final complexity + switch (i) { // each independent switch statement multiplies complexity by 6 + case a: + // ternary with && adds 3 to switch's complexity + print(f(i) && g(i) ? fizz() : buzz()); + default: + // ternary with || adds 3 to switch's complexity + print(f(i) || g(i) ? fizz() : buzz()); + } + switch (i - 1) { // multiplies complexity by 6 + case a: + print(f(i) && g(i) ? fizz() : buzz()); + default: + print(f(i) || g(i) ? fizz() : buzz()); + } + switch (i + 1) { // multiplies complexity by 6 + case a: + print(f(i) && g(i) ? fizz() : buzz()); + default: + print(f(i) || g(i) ? fizz() : buzz()); + } + } + } + + public abstract boolean f(int x); + + public abstract boolean g(int x); + + public abstract String fizz(); + + public abstract String buzz(); + + public abstract void print(String str); +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/ArrayTypeStyleCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/ArrayTypeStyleCase.java new file mode 100644 index 0000000000000000000000000000000000000000..ff545bc253ec017a83a005b3c8cf3004a5284fd6 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/ArrayTypeStyleCase.java @@ -0,0 +1,12 @@ +public class ArrayTypeStyleCase { + int[] nums; // violation, 'Array brackets at illegal position' + String strings[]; // OK as follows C style since 'javaStyle' set to false + + char[] toCharArray() { // OK + return null; + } + + byte getData()[] { // violation, 'Array brackets at illegal position' + return null; + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/AvoidEscapedUnicodeCharactersCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/AvoidEscapedUnicodeCharactersCase.java new file mode 100644 index 0000000000000000000000000000000000000000..ef3733446b62647495ef2bbd0b773d762ea4afce --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/AvoidEscapedUnicodeCharactersCase.java @@ -0,0 +1,19 @@ +public class AvoidEscapedUnicodeCharactersCase { + // OK, perfectly clear even without a comment. + String unitAbbrev = "μs"; + // violation below, the reader has no idea what this is. 'should be avoided.' + String unitAbbrev1 = "\u03bcs"; + // violation below + String unitAbbrev2 = "\u03bc\u03bc\u03bc"; + // violation below + String unitAbbrev3 = "\u03bcs"; // it is μs + // violation below + String unitAbbrev4 = "\u03bc\u03bcs"; + + public static int content() { + char content = 'r'; + // violation below + return '\ufeff' + content; + } + +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/CommentsIndentationCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/CommentsIndentationCase.java new file mode 100644 index 0000000000000000000000000000000000000000..8716c12d94fb47eb9115040b28bbb93d8f9641e1 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/CommentsIndentationCase.java @@ -0,0 +1,19 @@ +public class CommentsIndentationCase { + boolean bool = true; + double d = 3.14; + + public void foo43() { + try { + int a; + if (a > 0) { + System.out.println("a > 0"); + // a < 0 + } else if (a < 0) { + System.out.println("a < 0"); + } + // 为什么我们要在这里捕获异常? + } catch (IOException e) { + + } + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/DescendantTokenCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/DescendantTokenCase.java new file mode 100644 index 0000000000000000000000000000000000000000..dcec0e8d8e0e190aa328e42a8f76c73834469954 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/DescendantTokenCase.java @@ -0,0 +1,71 @@ +public class DescendantTokenCase { + + public void foo1() { + int x = 1; + int y = 2; + switch (x) { // ok + case 1: + System.out.println("xyz"); + break; + } + switch (y) { // violation + case 1: + switch (y) { + case 2: + System.out.println("xyz"); + break; + } + break; + } + } + + public void foo2() { + try { + // Some code + } catch (Exception e) { // ok + System.out.println("xyz"); + return; + } finally { // ok + System.out.println("xyz"); + } + try { + // Some code + } catch (Exception e) { + try { // violation + // Some code + } catch (Exception ex) { + // handle exception + } + } finally { + try { // violation + // Some code + } catch (Exception e) { + // handle exception + } + } + } + + public void foo3() { + int[] array = new int[]{1, 2, 3, 4, 5}; + + for (int i = 0; i != array.length; i++) { // ok + System.out.println(i); + } + + int j = 0; + for (; j != array.length; ) { // violation + System.out.println(j); + j++; + } + } + + public void foo4() { + for (int i = 0; i != 10; i++) { // ok + System.out.println(i); + } + int k = 0; + for (; ; ) { // violation + System.out.println(k); + } + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/IndentationCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/IndentationCase.java new file mode 100644 index 0000000000000000000000000000000000000000..73ca71117214628c1160c49ad6a1f8cc84588024 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/IndentationCase.java @@ -0,0 +1,27 @@ +public class IndentationCase { + String field; // basicOffset + int[] arr = { // basicOffset + 5, // arrayInitIndent + 6 }; // arrayInitIndent + void bar() throws Exception // basicOffset + { // braceAdjustment + foo(); // basicOffset + } // braceAdjustment + void foo() { // basicOffset + if ((cond1 && cond2) // basicOffset + || (cond3 && cond4) // lineWrappingIndentation, forceStrictCondition + ||!(cond5 && cond6)) { // lineWrappingIndentation, forceStrictCondition + field.doSomething() // basicOffset + .doSomething() // lineWrappingIndentation and forceStrictCondition + .doSomething( c -> { // lineWrappingIndentation and forceStrictCondition + return c.doSome(); // basicOffset + }); + } + } + void fooCase() // basicOffset + throws Exception { // throwsIndent + switch (field) { // basicOffset + case "value" : bar(); // caseIndent + } + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/NewlineAtEndOfFileCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/NewlineAtEndOfFileCase.java new file mode 100644 index 0000000000000000000000000000000000000000..809e69e044902451429064f5bafe8100d65fb8c1 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/NewlineAtEndOfFileCase.java @@ -0,0 +1,3 @@ +public class NewlineAtEndOfFileCase { // +// +} // no below it is violation diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/NoCodeInFileCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/NoCodeInFileCase.java new file mode 100644 index 0000000000000000000000000000000000000000..e6fc693afe3a8a657d21370798da2f7cf8e8496c --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/NoCodeInFileCase.java @@ -0,0 +1,3 @@ +//public class NoCodeInFileCase { +// signal +//} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/OuterTypeFilenameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/OuterTypeFilenameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..6815c84f6d0dbee7ea9a41837594bd0448018142 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/OuterTypeFilenameCase.java @@ -0,0 +1,2 @@ +public class Outer2TypeFilenameCase { +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/TodoCommentCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/TodoCommentCase.java new file mode 100644 index 0000000000000000000000000000000000000000..6a9810810003ed214cd3909689b9325bbf9a5393 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/TodoCommentCase.java @@ -0,0 +1,10 @@ +public class TodoCommentCase { + int i; + int x; + public void test() { + i++; // TODO: do differently in future // violation + i++; // todo: do differently in future + i=i/x; // FIXME: handle x = 0 case + i=i/x; // FIX : handle x = 0 case + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/UpperEllCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/UpperEllCase.java new file mode 100644 index 0000000000000000000000000000000000000000..9ce60018b8fa06431e6eb72c064b16e417859b2f --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/miscellaneous/UpperEllCase.java @@ -0,0 +1,5 @@ +public class UpperEllCase { + long var1 = 508987; // OK + long var2 = 508987l; // violation + long var3 = 508987L; // OK +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/modifiers/ModifierOrderCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/modifiers/ModifierOrderCase.java new file mode 100644 index 0000000000000000000000000000000000000000..2c83fa2967fba4467d6f6280ac1f54a83b65a8aa --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/modifiers/ModifierOrderCase.java @@ -0,0 +1,6 @@ +public class ModifierOrderCase { + + public final static foo() { + + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/modifiers/RedundantModifierCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/modifiers/RedundantModifierCase.java new file mode 100644 index 0000000000000000000000000000000000000000..24c23ea42d80b50efa05194a27a793fabc24f0a2 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/modifiers/RedundantModifierCase.java @@ -0,0 +1,18 @@ +public class RedundantModifierCase { + +} + +class PackagePrivateClass { + public PackagePrivateClass() {} // violation expected +} + +public enum EnumClass { + FIELD_1, + FIELD_2 { + @Override + public final void method1() {} // violation expected + }; + + public void method1() {} + public final void method2() {} // no violation expected +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/AbbreviationAsWordInNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/AbbreviationAsWordInNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..3c6f44b35f97315b5e85a604ac0d1e538a8fdf33 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/AbbreviationAsWordInNameCase.java @@ -0,0 +1,20 @@ +public class AbbreviationAsWordInNameCase { + int CURRENT_COUNTER; // violation 'no more than '4' consecutive capital letters' + static int GLOBAL_COUNTER; // OK, static is ignored + final Set stringsFOUND = new HashSet<>(); // OK, final is ignored + + @Override + public void printCOUNTER() { // OK, overridden method is ignored + System.out.println(CURRENT_COUNTER); + } + + // violation below 'no more than '4' consecutive capital letters' + void incrementCOUNTER() { + CURRENT_COUNTER++; // OK, only definitions are checked + } + + // violation below 'no more than '4' consecutive capital letters' + static void incrementGLOBAL() { + GLOBAL_COUNTER++; // OK, only definitions are checked + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ClassTypeParameterNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ClassTypeParameterNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..0888ea6c478be4427f2ac0aac427bb979d4993ad --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ClassTypeParameterNameCase.java @@ -0,0 +1,4 @@ +public class ClassTypeParameterNameCase { + class MyClass1 {} + class MyClass2 {} // violation +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ConstantNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ConstantNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..2472f089f915be9fce7ce859974212c9dc0dc90f --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ConstantNameCase.java @@ -0,0 +1,11 @@ +public class ConstantNameCase { + public final static int FIRST_CONSTANT1 = 10; + protected final static int SECOND_CONSTANT2 = 100; + final static int third_Constant3 = 1000; // violation 'must match pattern' + private final static int fourth_Const4 = 50; // violation 'must match pattern' + public final static int log = 10; + protected final static int logger = 50; + final static int loggerMYSELF = 5; // violation 'must match pattern' + final static int MYSELF = 100; + protected final static int myselfConstant = 1; // violation 'must match pattern' +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/IllegalIdentifierNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/IllegalIdentifierNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..39cc40383f05b910af0ddfcca7fb87839790b19b --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/IllegalIdentifierNameCase.java @@ -0,0 +1,3 @@ +public class IllegalIdentifierNameCase { + Integer _ = 4; // violation, 'Name '_' must match pattern' +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/InterfaceTypeParameterNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/InterfaceTypeParameterNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..e835153e96afd9bc10bc3ddf92e633572333a5e1 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/InterfaceTypeParameterNameCase.java @@ -0,0 +1,15 @@ +public class InterfaceTypeParameterNameCase { + + interface FirstInterface { + } + + interface SecondInterface { + } + + interface ThirdInterface { + } // violation + + interface ThirdInterface { + } // violation + +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/LocalFinalVariableNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/LocalFinalVariableNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..9b69149cd1425552432985c8c5b2d6a98d047f8f --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/LocalFinalVariableNameCase.java @@ -0,0 +1,11 @@ +public class LocalFinalVariableNameCase { + void MyMethod() { + try { + final int VAR1 = 5; // violation + final int var1 = 10; + } catch (Exception ex) { + final int VAR2 = 15; // violation + final int dataName = 20; + } + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/LocalVariableNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/LocalVariableNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..4feece9a225c26039e895c9b26f98b6edd825bc9 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/LocalVariableNameCase.java @@ -0,0 +1,8 @@ +public class LocalVariableNameCase { + void MyMethod() { + for (int var = 1; var < 10; var++) {} + for (int VAR = 1; VAR < 10; VAR++) {} // violation + for (int i = 1; i < 10; i++) {} + for (int var_1 = 0; var_1 < 10; var_1++) {} // violation + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MemberNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MemberNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..ebed1118b53a7936f3d596f507f26a3273e106da --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MemberNameCase.java @@ -0,0 +1,17 @@ +public class MemberNameCase { + public int num1; + protected int num2; + final int num3 = 3; + private int num4; + + static int num5; + public static final int CONSTANT = 1; + + public int NUM1; // violation + + protected int NUM2; // violation + + int NUM3; // violation + + private int NUM4; // violation +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MethodNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MethodNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..966b142c92031a4c4de39b8792dcc10662d540ae --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MethodNameCase.java @@ -0,0 +1,4 @@ +public class MethodNameCase { + public void method1() {} + public void Method2() {} // violation +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MethodTypeParameterNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MethodTypeParameterNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..1ef7cde27263157e1e122643f1dee24072201a79 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/MethodTypeParameterNameCase.java @@ -0,0 +1,6 @@ +public class MethodTypeParameterNameCase { + public void method1() {} + public void method2() {} // violation + public void method3() {} + public void method4() {} // violation +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/PackageNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/PackageNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..e6061ef63e1e36310ac5ff2a3d509bb1c1172d75 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/PackageNameCase.java @@ -0,0 +1,11 @@ +package com; // OK +package COM; // violation, name 'COM' must match pattern '^[a-z]+(\.[a-zA-Z_]\w*)*$' +package com.checkstyle.checks; // OK +package com.A.checkstyle.checks; // OK +package com.checkstyle1.checks; // OK +package com.checkSTYLE.checks; // OK +package com._checkstyle.checks_; // OK + +public class PackageNameCase { + +} diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ParameterNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ParameterNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..15c1145621fc1a9de97b3839c99cf93db628452d --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/ParameterNameCase.java @@ -0,0 +1,4 @@ +public class ParameterNameCase { + void method1(int v1) {} + void method2(int V2) {} // violation +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/PatternVariableNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/PatternVariableNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..698b315bcf30801520d647868292588b723ae547 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/PatternVariableNameCase.java @@ -0,0 +1,8 @@ +public class PatternVariableNameCase { + void foo(Object o1){ + if (o1 instanceof String STRING) {} // violation + if (o1 instanceof Integer num) {} + if (o1 instanceof Integer num_1) {} // violation + if (o1 instanceof Integer n) {} + } +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/RecordComponentNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/RecordComponentNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..6b4c7c58d2b9c0315c4d702874064cfc67e5512b --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/RecordComponentNameCase.java @@ -0,0 +1,11 @@ +public class RecordComponentNameCase { + record MyRecord1(String value, int otherComponentName) {} // OK + record MyRecord2(String... Values) {} // violation, the record component name + // should match the regular expression "^[a-z][a-zA-Z0-9]*$" + record MyRecord3(double my_number) {} // violation, the record component name + // should match the regular expression "^[a-z][a-zA-Z0-9]*$" + record MyRecord1(String value, int other) {} // OK + record MyRecord2(String... strings) {} // OK + record MyRecord3(double myNumber) {} // violation, the record component name + // should match the regular expression "^[a-z]+$" +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/RecordTypeParameterNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/RecordTypeParameterNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..700b693951545fbcd8dd1602c72290957afa8a0a --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/RecordTypeParameterNameCase.java @@ -0,0 +1,6 @@ +public class RecordTypeParameterNameCase { + record MyRecord1 {} // OK + record MyRecord2 {} // OK + record MyRecord3 {} // violation, the record type parameter + // name should match the regular expression "^[a-zA-Z]$" +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/StaticVariableNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/StaticVariableNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..5bdcf2bb12e2ed7f031d9e04bae39757a57978f7 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/StaticVariableNameCase.java @@ -0,0 +1,12 @@ +public class StaticVariableNameCase { + public static int goodStatic = 2; + private static int badStatic = 2; + public static int ItStatic1 = 2; // violation, 'must match pattern' + protected static int ItStatic2 = 2; // violation, 'must match pattern' + private static int ItStatic = 2; // violation, 'must match pattern' + public static int it_static = 2; // violation, 'must match pattern' + public static int It_Static = 2; // violation, 'must match pattern' + private static int It_Static1 = 2; // violation, 'must match pattern' + static int It_Static2 = 2; // violation, 'must match pattern' + public static final int IT_STATIC = 2; +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/TypeNameCase.java b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/TypeNameCase.java new file mode 100644 index 0000000000000000000000000000000000000000..7fd849aa0185919145b0128f9944318f67ab8b6b --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/case/naming_conventions/TypeNameCase.java @@ -0,0 +1,6 @@ +public class TypeNameCase { + public interface FirstName {} + protected class SecondName {} + enum Third_Name {} // violation + private class FourthName_ {} // violation +} \ No newline at end of file diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/BooleanExpressionComplexity.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/BooleanExpressionComplexity.xml new file mode 100644 index 0000000000000000000000000000000000000000..e15df0179128481b294e3668a28f1a27faae92ec --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/BooleanExpressionComplexity.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/ClassDataAbstractionCoupling.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/ClassDataAbstractionCoupling.xml new file mode 100644 index 0000000000000000000000000000000000000000..725c400ffa92436e314f9da06c08eb2257a1161f --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/ClassDataAbstractionCoupling.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/ClassFanOutComplexity.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/ClassFanOutComplexity.xml new file mode 100644 index 0000000000000000000000000000000000000000..12bb1e433fecefe0e801c3903929e13965c966cd --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/ClassFanOutComplexity.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/CyclomaticComplexity.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/CyclomaticComplexity.xml new file mode 100644 index 0000000000000000000000000000000000000000..10f0e2cdeada8fa3cb9d1e94b1f341cf8bcac5e0 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/CyclomaticComplexity.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/JavaNCSS.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/JavaNCSS.xml new file mode 100644 index 0000000000000000000000000000000000000000..97ace2da2d49fa5d58cc50226a89ceef2c081311 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/JavaNCSS.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/NPathComplexity.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/NPathComplexity.xml new file mode 100644 index 0000000000000000000000000000000000000000..520be8abb509a912b938583ce30e92891fe6bb85 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/metrics/NPathComplexity.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/ArrayTypeStyle.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/ArrayTypeStyle.xml new file mode 100644 index 0000000000000000000000000000000000000000..b41357d524814d5a0ec3c393f734de6db1b37c00 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/ArrayTypeStyle.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/AvoidEscapedUnicodeCharacters.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/AvoidEscapedUnicodeCharacters.xml new file mode 100644 index 0000000000000000000000000000000000000000..53c6825339a736683219c13ed6f1d0c80f9dfc51 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/AvoidEscapedUnicodeCharacters.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/CommentsIndentation.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/CommentsIndentation.xml new file mode 100644 index 0000000000000000000000000000000000000000..52dc5cd0ccbe4ab6f14ffa41b1687da98d166bfd --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/CommentsIndentation.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/DescendantToken.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/DescendantToken.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae49835322d052e0b0513a54c76dc4e4ace90e19 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/DescendantToken.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/FinalParameters.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/FinalParameters.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a67a581a39cb4c350e02fbc2beb30d57f41717d --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/FinalParameters.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/Indentation.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/Indentation.xml new file mode 100644 index 0000000000000000000000000000000000000000..e29af545327c4d9abd5e7b2659d975cb70ff4367 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/Indentation.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/NewlineAtEndOfFile.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/NewlineAtEndOfFile.xml new file mode 100644 index 0000000000000000000000000000000000000000..921da91370eff83cd6977845d572f8a47d5b0a08 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/NewlineAtEndOfFile.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/NoCodeInFile.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/NoCodeInFile.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae3ffcaf2ee21e42a5f707fd8f6af8b9ddba0f24 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/NoCodeInFile.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/OuterTypeFilename.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/OuterTypeFilename.xml new file mode 100644 index 0000000000000000000000000000000000000000..a5fa53f4eb9be4084ba4981c9a40a78902d30991 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/OuterTypeFilename.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/TodoComment.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/TodoComment.xml new file mode 100644 index 0000000000000000000000000000000000000000..543fa99316de005d887e29ce76a67791c6c6a42c --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/TodoComment.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/UpperEll.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/UpperEll.xml new file mode 100644 index 0000000000000000000000000000000000000000..207735d7051642436070e70ae910066e51c37127 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/miscellaneous/UpperEll.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/modifiers/ModifierOrder.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/modifiers/ModifierOrder.xml new file mode 100644 index 0000000000000000000000000000000000000000..cd7eedf5ed8695dc4e252c6cee5e499ca263871c --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/modifiers/ModifierOrder.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/modifiers/RedundantModifier.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/modifiers/RedundantModifier.xml new file mode 100644 index 0000000000000000000000000000000000000000..c176c1c4d023a35e73bdacede848adba816c6c3d --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/modifiers/RedundantModifier.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/AbbreviationAsWordInName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/AbbreviationAsWordInName.xml new file mode 100644 index 0000000000000000000000000000000000000000..52f5aaabe21a5533250f38b734f98a61f0b51dde --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/AbbreviationAsWordInName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ClassTypeParameterName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ClassTypeParameterName.xml new file mode 100644 index 0000000000000000000000000000000000000000..2592f3c917536690a8e83f4dcc943f45339b354d --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ClassTypeParameterName.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ConstantName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ConstantName.xml new file mode 100644 index 0000000000000000000000000000000000000000..047f635109cf64c25a2acc0fa0cdeb5541b7ec77 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ConstantName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/IllegalIdentifierName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/IllegalIdentifierName.xml new file mode 100644 index 0000000000000000000000000000000000000000..7149643bc2ae5a1f4b9dba0962c2d2849f5f2f7d --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/IllegalIdentifierName.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/InterfaceTypeParameterName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/InterfaceTypeParameterName.xml new file mode 100644 index 0000000000000000000000000000000000000000..123c939c00beb6cf6b2cdcc7669131c95be292f3 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/InterfaceTypeParameterName.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/LocalFinalVariableName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/LocalFinalVariableName.xml new file mode 100644 index 0000000000000000000000000000000000000000..0862e17bd663503ab8439306e4b0b5b2a3808189 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/LocalFinalVariableName.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/LocalVariableName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/LocalVariableName.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa59897ccfeb964a45120d076dd87c16f5397594 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/LocalVariableName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MemberName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MemberName.xml new file mode 100644 index 0000000000000000000000000000000000000000..d574a52731d5a167e80b6a0c10a5fbceb65aad2f --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MemberName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MethodName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MethodName.xml new file mode 100644 index 0000000000000000000000000000000000000000..b30b534e9537655ae5c795437c89e709e8477dcd --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MethodName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MethodTypeParameterName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MethodTypeParameterName.xml new file mode 100644 index 0000000000000000000000000000000000000000..055b8b66cb7c171b5db99045bc59994233b92b50 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/MethodTypeParameterName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/PackageName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/PackageName.xml new file mode 100644 index 0000000000000000000000000000000000000000..46656c7783fd0c4c621dbec2c8eeedbb73a8f024 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/PackageName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ParameterName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ParameterName.xml new file mode 100644 index 0000000000000000000000000000000000000000..7f0362ca6da19092cf09d98716aa3c16faeef6bc --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/ParameterName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/PatternVariableName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/PatternVariableName.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b046a0ec848a4593739d6562e883c930912accd --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/PatternVariableName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/RecordComponentName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/RecordComponentName.xml new file mode 100644 index 0000000000000000000000000000000000000000..768d04d3a5d1b352f62426e386839797f111a5d9 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/RecordComponentName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/RecordTypeParameterName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/RecordTypeParameterName.xml new file mode 100644 index 0000000000000000000000000000000000000000..4869b492aeb999bb426ea45e71528d47d0ef9e69 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/RecordTypeParameterName.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/StaticVariableName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/StaticVariableName.xml new file mode 100644 index 0000000000000000000000000000000000000000..7aed2aba554ce1483665f3f692cf10b9470a8335 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/StaticVariableName.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/TypeName.xml b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/TypeName.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ef0b703937eafbe86658b720b2dfa55c98367a3 --- /dev/null +++ b/component/CodeInspector/code_inspector/src/test/resources/single_rules/naming_conventions/TypeName.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + +