Package org.codenarc.rule
Interface Rule
-
- All Known Implementing Classes:
AbcMetricRule,AbstractAstVisitorRule,AbstractClassNameRule,AbstractClassWithoutAbstractMethodRule,AbstractClassWithPublicConstructorRule,AbstractEnhanceableAstVisitorRule,AbstractImportRule,AbstractJavadocEmptyTagRule,AbstractJavadocMissingDescriptionRule,AbstractRule,AbstractSharedAstVisitorRule,AddEmptyStringRule,AssertWithinFinallyBlockRule,AssignCollectionSortRule,AssignCollectionUniqueRule,AssignmentInConditionalRule,AssignmentToStaticFieldFromInstanceMethodRule,BigDecimalInstantiationRule,BitwiseOperatorInConditionalRule,BlankLineBeforePackageRule,BlockEndsWithBlankLineRule,BlockStartsWithBlankLineRule,BooleanGetBooleanRule,BooleanMethodReturnsNullRule,BracesForClassRule,BracesForForLoopRule,BracesForIfElseRule,BracesForMethodRule,BracesForTryCatchFinallyRule,BrokenNullCheckRule,BrokenOddnessCheckRule,BuilderMethodWithSideEffectsRule,BusyWaitRule,CatchArrayIndexOutOfBoundsExceptionRule,CatchErrorRule,CatchExceptionRule,CatchIllegalMonitorStateExceptionRule,CatchIndexOutOfBoundsExceptionRule,CatchNullPointerExceptionRule,CatchRuntimeExceptionRule,CatchThrowableRule,ChainedTestRule,ClassEndsWithBlankLineRule,ClassForNameRule,ClassJavadocRule,ClassNameRule,ClassNameSameAsFilenameRule,ClassNameSameAsSuperclassRule,ClassSizeRule,ClassStartsWithBlankLineRule,CloneableWithoutCloneRule,CloneWithoutCloneableRule,CloseWithoutCloseableRule,ClosureAsLastMethodParameterRule,ClosureStatementOnOpeningLineOfMultipleLineClosureRule,CollectAllIsDeprecatedRule,CompareToWithoutComparableRule,ComparisonOfTwoConstantsRule,ComparisonWithSelfRule,CompileStaticRule,ConfusingClassNamedExceptionRule,ConfusingMethodNameRule,ConfusingMultipleReturnsRule,ConfusingTernaryRule,ConsecutiveBlankLinesRule,ConsecutiveLiteralAppendsRule,ConsecutiveStringConcatenationRule,ConstantAssertExpressionRule,ConstantIfExpressionRule,ConstantsOnlyInterfaceRule,ConstantTernaryExpressionRule,CouldBeElvisRule,CouldBeSwitchStatementRule,CoupledTestCaseRule,CrapMetricRule,CyclomaticComplexityRule,DeadCodeRule,DirectConnectionManagementRule,DoubleCheckedLockingRule,DoubleNegativeRule,DuplicateCaseStatementRule,DuplicateImportRule,DuplicateListLiteralRule,DuplicateMapKeyRule,DuplicateMapLiteralRule,DuplicateNumberLiteralRule,DuplicateSetValueRule,DuplicateStringLiteralRule,ElseBlockBracesRule,EmptyCatchBlockRule,EmptyClassRule,EmptyElseBlockRule,EmptyFinallyBlockRule,EmptyForStatementRule,EmptyIfStatementRule,EmptyInstanceInitializerRule,EmptyMethodInAbstractClassRule,EmptyMethodRule,EmptyStaticInitializerRule,EmptySwitchStatementRule,EmptySynchronizedStatementRule,EmptyTryBlockRule,EmptyWhileStatementRule,EnumCustomSerializationIgnoredRule,EqualsAndHashCodeRule,EqualsOverloadedRule,ExceptionExtendsErrorRule,ExceptionExtendsThrowableRule,ExceptionNotThrownRule,ExplicitArrayListInstantiationRule,ExplicitCallToAndMethodRule,ExplicitCallToCompareToMethodRule,ExplicitCallToDivMethodRule,ExplicitCallToEqualsMethodRule,ExplicitCallToGetAtMethodRule,ExplicitCallToLeftShiftMethodRule,ExplicitCallToMinusMethodRule,ExplicitCallToModMethodRule,ExplicitCallToMultiplyMethodRule,ExplicitCallToOrMethodRule,ExplicitCallToPlusMethodRule,ExplicitCallToPowerMethodRule,ExplicitCallToPutAtMethodRule,ExplicitCallToRightShiftMethodRule,ExplicitCallToXorMethodRule,ExplicitGarbageCollectionRule,ExplicitHashMapInstantiationRule,ExplicitHashSetInstantiationRule,ExplicitLinkedHashMapInstantiationRule,ExplicitLinkedListInstantiationRule,ExplicitStackInstantiationRule,ExplicitTreeSetInstantiationRule,FactoryMethodNameRule,FieldNameRule,FieldTypeRequiredRule,FileCreateTempFileRule,FileEndsWithoutNewlineRule,FinalClassWithProtectedMemberRule,ForLoopShouldBeWhileLoopRule,ForStatementBracesRule,GetterMethodCouldBePropertyRule,GrailsDomainHasEqualsRule,GrailsDomainHasToStringRule,GrailsDomainReservedSqlKeywordNameRule,GrailsDomainStringPropertyMaxSizeRule,GrailsDomainWithServiceReferenceRule,GrailsDuplicateConstraintRule,GrailsDuplicateMappingRule,GrailsMassAssignmentRule,GrailsPublicControllerMethodRule,GrailsServletContextReferenceRule,GrailsStatelessServiceRule,GroovyLangImmutableRule,GStringAsMapKeyRule,GStringExpressionWithinStringRule,HardCodedWindowsFileSeparatorRule,HardCodedWindowsRootDirectoryRule,HashtableIsObsoleteRule,IfStatementBracesRule,IfStatementCouldBeTernaryRule,IllegalClassMemberRule,IllegalClassReferenceRule,IllegalPackageReferenceRule,IllegalRegexRule,IllegalStringRule,IllegalSubclassRule,ImplementationAsTypeRule,ImportFromSamePackageRule,ImportFromSunPackagesRule,InconsistentPropertyLockingRule,InconsistentPropertySynchronizationRule,IndentationRule,InsecureRandomRule,InstanceofRule,IntegerGetIntegerRule,InterfaceNameRule,InterfaceNameSameAsSuperInterfaceRule,InvertedConditionRule,InvertedIfElseRule,JavadocConsecutiveEmptyLinesRule,JavadocEmptyAuthorTagRule,JavadocEmptyExceptionTagRule,JavadocEmptyFirstLineRule,JavadocEmptyLastLineRule,JavadocEmptyParamTagRule,JavadocEmptyReturnTagRule,JavadocEmptySeeTagRule,JavadocEmptySinceTagRule,JavadocEmptyThrowsTagRule,JavadocEmptyVersionTagRule,JavadocMissingExceptionDescriptionRule,JavadocMissingParamDescriptionRule,JavadocMissingThrowsDescriptionRule,JavaIoPackageAccessRule,JdbcConnectionReferenceRule,JdbcResultSetReferenceRule,JdbcStatementReferenceRule,JUnitAssertAlwaysFailsRule,JUnitAssertAlwaysSucceedsRule,JUnitAssertEqualsConstantActualValueRule,JUnitFailWithoutMessageRule,JUnitLostTestRule,JUnitPublicFieldRule,JUnitPublicNonTestMethodRule,JUnitPublicPropertyRule,JUnitSetUpCallsSuperRule,JUnitStyleAssertionsRule,JUnitTearDownCallsSuperRule,JUnitTestMethodWithoutAssertRule,JUnitUnnecessarySetUpRule,JUnitUnnecessaryTearDownRule,JUnitUnnecessaryThrowsExceptionRule,LineLengthRule,LocaleSetDefaultRule,LoggerForDifferentClassRule,LoggerWithWrongModifiersRule,LoggingSwallowsStacktraceRule,LongLiteralWithLowerCaseLRule,MethodCountRule,MethodNameRule,MethodParameterTypeRequired,MethodReturnTypeRequiredRule,MethodSizeRule,MisorderedStaticImportsRule,MissingBlankLineAfterImportsRule,MissingBlankLineAfterPackageRule,MissingNewInThrowStatementRule,MissingOverrideAnnotationRule,MultipleLoggersRule,MultipleUnaryOperatorsRule,NestedBlockDepthRule,NestedForLoopRule,NestedSynchronizationRule,NoDefRule,NoJavaUtilDateRule,NonFinalPublicFieldRule,NonFinalSubclassOfSensitiveInterfaceRule,NoTabCharacterRule,NoWildcardImportsRule,ObjectFinalizeRule,ObjectOverrideMisspelledMethodNameRule,PackageNameMatchesFilePathRule,PackageNameRule,ParameterCountRule,ParameterNameRule,ParameterReassignmentRule,PrintlnRule,PrintStackTraceRule,PrivateFieldCouldBeFinalRule,PropertyNameRule,PublicFinalizeMethodRule,PublicInstanceFieldRule,PublicMethodsBeforeNonPublicMethodsRule,RandomDoubleCoercedToZeroRule,RemoveAllOnSelfRule,RequiredRegexRule,RequiredStringRule,ReturnFromFinallyBlockRule,ReturnNullFromCatchBlockRule,ReturnsNullInsteadOfEmptyArrayRule,ReturnsNullInsteadOfEmptyCollectionRule,SerializableClassMustDefineSerialVersionUIDRule,SerialPersistentFieldsRule,SerialVersionUIDRule,SimpleDateFormatMissingLocaleRule,SpaceAfterCatchRule,SpaceAfterClosingBraceRule,SpaceAfterCommaRule,SpaceAfterForRule,SpaceAfterIfRule,SpaceAfterOpeningBraceRule,SpaceAfterSemicolonRule,SpaceAfterSwitchRule,SpaceAfterWhileRule,SpaceAroundClosureArrowRule,SpaceAroundMapEntryColonRule,SpaceAroundOperatorRule,SpaceBeforeClosingBraceRule,SpaceBeforeOpeningBraceRule,SpockIgnoreRestUsedRule,StatelessClassRule,StatelessSingletonRule,StaticCalendarFieldRule,StaticConnectionRule,StaticDateFormatFieldRule,StaticFieldsBeforeInstanceFieldsRule,StaticMatcherFieldRule,StaticMethodsBeforeInstanceMethodsRule,StaticSimpleDateFormatFieldRule,StubRule,SwallowThreadDeathRule,SynchronizedMethodRule,SynchronizedOnBoxedPrimitiveRule,SynchronizedOnGetClassRule,SynchronizedOnReentrantLockRule,SynchronizedOnStringRule,SynchronizedOnThisRule,SynchronizedReadObjectMethodRule,SystemErrPrintRule,SystemExitRule,SystemOutPrintRule,SystemRunFinalizersOnExitRule,TernaryCouldBeElvisRule,ThisReferenceEscapesConstructorRule,ThreadGroupRule,ThreadLocalNotStaticFinalRule,ThreadYieldRule,ThrowErrorRule,ThrowExceptionFromFinallyBlockRule,ThrowExceptionRule,ThrowNullPointerExceptionRule,ThrowRuntimeExceptionRule,ThrowThrowableRule,ToStringReturnsNullRule,TrailingCommaRule,TrailingWhitespaceRule,UnnecessaryBigDecimalInstantiationRule,UnnecessaryBigIntegerInstantiationRule,UnnecessaryBooleanExpressionRule,UnnecessaryBooleanInstantiationRule,UnnecessaryCallForLastElementRule,UnnecessaryCallToSubstringRule,UnnecessaryCastRule,UnnecessaryCatchBlockRule,UnnecessaryCollectCallRule,UnnecessaryCollectionCallRule,UnnecessaryConstructorRule,UnnecessaryDefInFieldDeclarationRule,UnnecessaryDefInMethodDeclarationRule,UnnecessaryDefInVariableDeclarationRule,UnnecessaryDotClassRule,UnnecessaryDoubleInstantiationRule,UnnecessaryElseStatementRule,UnnecessaryFailRule,UnnecessaryFinalOnPrivateMethodRule,UnnecessaryFloatInstantiationRule,UnnecessaryGetterRule,UnnecessaryGroovyImportRule,UnnecessaryGStringRule,UnnecessaryIfStatementRule,UnnecessaryInstanceOfCheckRule,UnnecessaryInstantiationToGetClassRule,UnnecessaryIntegerInstantiationRule,UnnecessaryLongInstantiationRule,UnnecessaryModOneRule,UnnecessaryNullCheckBeforeInstanceOfRule,UnnecessaryNullCheckRule,UnnecessaryObjectReferencesRule,UnnecessaryOverridingMethodRule,UnnecessaryPackageReferenceRule,UnnecessaryParenthesesForMethodCallWithClosureRule,UnnecessaryPublicModifierRule,UnnecessaryReturnKeywordRule,UnnecessarySafeNavigationOperatorRule,UnnecessarySelfAssignmentRule,UnnecessarySemicolonRule,UnnecessarySetterRule,UnnecessaryStringInstantiationRule,UnnecessarySubstringRule,UnnecessaryTernaryExpressionRule,UnnecessaryToStringRule,UnnecessaryTransientModifierRule,UnsafeArrayDeclarationRule,UnsafeImplementationAsMapRule,UnusedArrayRule,UnusedImportRule,UnusedMethodParameterRule,UnusedObjectRule,UnusedPrivateFieldRule,UnusedPrivateMethodParameterRule,UnusedPrivateMethodRule,UnusedVariableRule,UseAssertEqualsInsteadOfAssertTrueRule,UseAssertFalseInsteadOfNegationRule,UseAssertNullInsteadOfAssertEqualsRule,UseAssertSameInsteadOfAssertTrueRule,UseAssertTrueInsteadOfAssertEqualsRule,UseAssertTrueInsteadOfNegationRule,UseCollectManyRule,UseCollectNestedRule,UseOfNotifyMethodRule,VariableNameRule,VariableTypeRequiredRule,VectorIsObsoleteRule,VolatileArrayFieldRule,VolatileLongOrDoubleFieldRule,WaitOutsideOfWhileLoopRule,WhileStatementBracesRule
public interface RuleRepresents a source code analysis rule .
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<Violation>applyTo(SourceCode sourceCode)Apply this rule to the specified source and return a list of violations (or an empty List)intgetCompilerPhase()java.lang.StringgetName()intgetPriority()
-
-
-
Method Detail
-
applyTo
java.util.List<Violation> applyTo(SourceCode sourceCode) throws java.lang.Throwable
Apply this rule to the specified source and return a list of violations (or an empty List)- Parameters:
sourceCode- - the source to apply this rule to- Returns:
- the List of violations; may be empty
- Throws:
java.lang.Throwable- could throw anything
-
getPriority
int getPriority()
- Returns:
- the priority of this rule; must be 1, 2 or 3
-
getName
java.lang.String getName()
- Returns:
- the unique id for this rule
-
getCompilerPhase
int getCompilerPhase()
- Returns:
- the required compiler phase (as in
Phases) of the AST of theSourceCodehanded to the rule viaapplyTo(SourceCode sourceCode)
-
-