CheckList { public static List<Class> getChecks() { return ImmutableList.<Class>of( AbortedTestCaseCheck.class, AliasFunctionUsageCheck.class, AllBranchesIdenticalCheck.class, AlwaysUseCurlyBracesCheck.class, ArgumentWithDefaultValueNotLastCheck.class, ArrayCountableCountCheck.class, AssertionArgumentOrderCheck.class, AssertionCompareToSelfCheck.class, AssertionInTryCatchCheck.class, AssertionsAfterExceptionCheck.class, AssertTrueInsteadOfDedicatedAssertCheck.class, AssignmentInSubExpressionCheck.class, AtLeastThreeCasesInSwitchCheck.class, AvoidDESCheck.class, BooleanEqualityComparisonCheck.class, BooleanOrNullLiteralInAssertionsCheck.class, CakePhpDebugModeCheck.class, CallParentConstructorCheck.class, CallToIniSetCheck.class, CatchRethrowingCheck.class, CatchThrowableCheck.class, ChangingAccessibilityCheck.class, CharacterBeforeOpeningPHPTagCheck.class, ChildAndParentExceptionCaughtCheck.class, ClassComplexityCheck.class, ClassCouplingCheck.class, ClassNameCheck.class, ClassNamedLikeExceptionCheck.class, ClosingTagInFullPHPFileCheck.class, CodeFollowingJumpStatementCheck.class, CollapsibleIfStatementCheck.class, CommandLineArgumentCheck.class, CommentedOutCodeCheck.class, ConcatenatedStringLiteralCheck.class, ConditionalIndentationCheck.class, ConditionalOnNewLineCheck.class, ConsistentFunctionReturnCheck.class, ConstantNameCheck.class, ConstructorDeclarationCheck.class, ConstructorDependencyInversionCheck.class, CookieDomainCheck.class, CookieSensitiveDataCheck.class, CookiesSecureCheck.class, CountInsteadOfEmptyCheck.class, CryptographicHashCheck.class, CryptographicKeySizeCheck.class, DataEncryptionCheck.class, DeadStoreCheck.class, DeprecatedPredefinedVariablesUseCheck.class, DirectlyAccessingSuperGlobalCheck.class, DuplicateBranchImplementationCheck.class, DuplicateConditionCheck.class, DuplicatedArgumentCheck.class, DuplicatedMethodCheck.class, EchoWithParenthesisCheck.class, ElseIfSequenceKeywordUsageCheck.class, ElseIfWithoutElseCheck.class, EmptyDatabasePasswordCheck.class, EmptyMethodCheck.class, EmptyNestedBlockCheck.class, EmptyStatementCheck.class, EncryptionModeAndPaddingCheck.class, EvalUseCheck.class, ExceptionTestingCheck.class, ExitOrDieUsageCheck.class, ExpressionComplexityCheck.class, FieldNameCheck.class, FileHeaderCheck.class, FileNameCheck.class, FileWithSymbolsAndSideEffectsCheck.class, FixmeTagPresenceCheck.class, ForHidingWhileCheck.class, ForLoopCounterChangedCheck.class, ForLoopIncrementSignCheck.class, FormattingStandardCheck.class, FunctionCallArgumentsNumberCheck.class, FunctionCognitiveComplexityCheck.class, FunctionComplexityCheck.class, FunctionDefineOutsideClassCheck.class, FunctionNameCheck.class, GenericExceptionCheck.class, GlobalKeywordAndArrayUsageCheck.class, GotoUseCheck.class, HashFunctionCheck.class, HardCodedCredentialsCheck.class, HardCodedIpAddressCheck.class, HardCodedUriCheck.class, HttpOnlyCheck.class, IdenticalOperandsInBinaryExpressionCheck.class, IfConditionAlwaysTrueOrFalseCheck.class, IgnoredReturnValueCheck.class, ImmediatelyReturnedVariableCheck.class, IncrementDecrementInSubExpressionCheck.class, InheritanceDepthCheck.class, InlineHTMLInFileCheck.class, InsecureHashCheck.class, InterfaceNameCheck.class, InvertedBooleanCheck.class, KeywordsAndConstantsNotLowerCaseCheck.class, LDAPAuthenticatedConnectionCheck.class, LeftCurlyBraceEndsLineCheck.class, LeftCurlyBraceStartsLineCheck.class, LineLengthCheck.class, LocalVariableAndParameterNameCheck.class, LocalVariableShadowsClassFieldCheck.class, LoggerConfigurationCheck.class, LogicalWordOperatorUsageCheck.class, LoopExecutingAtMostOnceCheck.class, LowerCaseColorCheck.class, MethodNameReturningBooleanCheck.class, MissingMethodVisibilityCheck.class, MissingNewLineAtEOFCheck.class, ModifiersOrderCheck.class, MoreThanOneClassInFileCheck.class, MultilineBlocksCurlyBracesCheck.class, NestedControlFlowDepthCheck.class, NestedFunctionDepthCheck.class, NestedSwitchCheck.class, NestedTernaryOperatorsCheck.class, NoAssertionInTestCheck.class, NonEmptyCaseWithoutBreakCheck.class, NonLFCharAsEOLCheck.class, NoPaddingRsaCheck.class, NoSonarCheck.class, NotDiscoverableTestCheck.class, NoTestInTestClassCheck.class, NullDereferenceInConditionalCheck.class, OneExpectedCheckExceptionCheck.class, OnePropertyDeclarationPerStatementCheck.class, OneStatementPerLineCheck.class, OpeningPHPTagCheck.class, OverridingMethodSimplyCallParentCheck.class, OverwrittenArrayElementCheck.class, ParameterSequenceCheck.class, ParsingErrorCheck.class, PerlStyleCommentsUsageCheck.class, PermissionsControlCheck.class, PHPDeprecatedFunctionUsageCheck.class, PhpSapiNameFunctionUsageCheck.class, QueryUsageCheck.class, RandomGeneratorCheck.class, ReassignedBeforeUsedCheck.class, RedundantFinalCheck.class, RedundantJumpCheck.class, RedundantParenthesesCheck.class, ReferenceInFunctionCallCheck.class, RegexUsageCheck.class, RepeatedComplementOperatorCheck.class, RequireIncludeInstructionsUsageCheck.class, RequireInsteadOfRequireOnceCheck.class, ReturnOfBooleanExpressionCheck.class, RightCurlyBraceStartsLineCheck.class, RobustCipherAlgorithmCheck.class, SelfAssignmentCheck.class, SelfKeywordUsageCheck.class, SessionCookiePersistenceCheck.class, SessionFixationCheck.class, SignallingProcessCheck.class, SilencedErrorsCheck.class, SleepFunctionUsageCheck.class, SocketUsageCheck.class, SSLCertificatesVerificationDisabledCheck.class, SSLHostVerificationDisabledCheck.class, StandardInputUsageCheck.class, StringLiteralDuplicatedCheck.class, SwitchCaseTooBigCheck.class, SwitchDefaultPositionCheck.class, SwitchWithoutDefaultCheck.class, TabCharacterCheck.class, TestClassNameCheck.class, ThisVariableUsageInStaticContextCheck.class, ThrowThrowableCheck.class, TodoTagPresenceCheck.class, TooManyCasesInSwitchCheck.class, TooManyFieldsInClassCheck.class, TooManyFunctionParametersCheck.class, TooManyLinesInClassCheck.class, TooManyLinesInFileCheck.class, TooManyLinesInFunctionCheck.class, TooManyMethodsInClassCheck.class, TooManyReturnCheck.class, TrailingCommentCheck.class, TrailingWhitespaceCheck.class, UncatchableExceptionCheck.class, UnreachableCatchBlockCheck.class, UnserializeCallCheck.class, UnsetForeachReferenceVariableCheck.class, UnusedExceptionCheck.class, UnusedFunctionParametersCheck.class, UnusedLocalVariableCheck.class, UnusedPrivateFieldCheck.class, UnusedPrivateMethodCheck.class, UselessExpressionStatementCheck.class, UselessIncrementCheck.class, UselessObjectCreationCheck.class, UseOfEmptyReturnValueCheck.class, UseOfOctalValueCheck.class, UseOfUninitializedVariableCheck.class, VariableVariablesCheck.class, VarKeywordUsageCheck.class, WeakSSLProtocolCheck.class, WrongAssignmentOperatorCheck.class); } private  CheckList(); static List<Class> getChecks(); static Iterable<Class> getPhpIniChecks(); static Set<Class> getAllChecks(); static final String REPOSITORY_KEY; }
@Test public void count() { int count = 0; List<File> files = new ArrayList<>(); for (String folder : new String[] { "src/main/java/org/sonar/php/checks/", "src/main/java/org/sonar/php/checks/security", "src/main/java/org/sonar/php/checks/phpunit" }) { files.addAll(FileUtils.listFiles(new File(folder), new String[]{"java"}, false)); } for (File file : files) { if (file.getName().endsWith("Check.java")) { count++; } } assertThat(CheckList.getChecks()).hasSize(count); }