Class ClassFanOutComplexityCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.AbstractCheck
com.puppycrawl.tools.checkstyle.checks.metrics.AbstractClassCouplingCheck
com.puppycrawl.tools.checkstyle.checks.metrics.ClassFanOutComplexityCheck
- All Implemented Interfaces:
- Configurable,- Contextualizable
 Checks the number of other types a given class/record/interface/enum/annotation
 relies on. Also, the square of this has been shown to indicate the amount
 of maintenance required in functional programs (on a file basis) at least.
 
 This check processes files in the following way:
- Iterates over all tokens that might contain type reference.
- 
 If a class was imported with direct import (i.e. import java.math.BigDecimal), or the class was referenced with the package name (i.e.java.math.BigDecimal value) and the package was added to theexcludedPackagesparameter, the class does not increase complexity.
- 
 If a class name was added to the excludedClassesparameter, the class does not increase complexity.
- Since:
- 3.4
- 
Nested Class SummaryNested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBeanAbstractAutomaticBean.OutputStreamOptions
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final intDefault value of max value.static final StringA key is pointing to the warning message text in "messages.properties" file.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionint[]The configurable token set.protected StringReturns message key we use for log violations.int[]The tokens that this check must be registered for.voidsetExcludeClassesRegexps(Pattern... from) Setter to specify user-configured regular expressions to ignore classes.voidsetExcludedClasses(String... excludedClasses) Setter to specify user-configured class names to ignore.voidsetExcludedPackages(String... excludedPackages) Setter to specify user-configured packages to ignore.Methods inherited from class com.puppycrawl.tools.checkstyle.checks.metrics.AbstractClassCouplingCheckbeginTree, getDefaultTokens, leaveToken, setMax, visitTokenMethods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheckclearViolations, destroy, finishTree, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, init, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokensMethods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporterfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityMethods inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBeanconfigure, contextualize, getConfiguration, setupChild
- 
Field Details- 
MSG_KEYA key is pointing to the warning message text in "messages.properties" file.- See Also:
 
- 
DEFAULT_MAXDefault value of max value.- See Also:
 
 
- 
- 
Constructor Details- 
ClassFanOutComplexityCheckpublic ClassFanOutComplexityCheck()Creates new instance of this check.
 
- 
- 
Method Details- 
getRequiredTokensDescription copied from class:AbstractCheckThe tokens that this check must be registered for.- Specified by:
- getRequiredTokensin class- AbstractCheck
- Returns:
- the token set this must be registered for.
- See Also:
 
- 
getAcceptableTokensDescription copied from class:AbstractCheckThe configurable token set. Used to protect Checks against malicious users who specify an unacceptable token set in the configuration file. The default implementation returns the check's default tokens.- Specified by:
- getAcceptableTokensin class- AbstractCheck
- Returns:
- the token set this check is designed for.
- See Also:
 
- 
getLogMessageIdDescription copied from class:AbstractClassCouplingCheckReturns message key we use for log violations.- Specified by:
- getLogMessageIdin class- AbstractClassCouplingCheck
- Returns:
- message key we use for log violations.
 
- 
setExcludeClassesRegexpsSetter to specify user-configured regular expressions to ignore classes.- Overrides:
- setExcludeClassesRegexpsin class- AbstractClassCouplingCheck
- Parameters:
- from- array representing regular expressions of classes to ignore.
 
- 
setExcludedClassesSetter to specify user-configured class names to ignore.- Overrides:
- setExcludedClassesin class- AbstractClassCouplingCheck
- Parameters:
- excludedClasses- classes to ignore.
 
- 
setExcludedPackagesSetter to specify user-configured packages to ignore.- Overrides:
- setExcludedPackagesin class- AbstractClassCouplingCheck
- Parameters:
- excludedPackages- packages to ignore.
- Throws:
- IllegalArgumentException- if there are invalid identifiers among the packages.
 
 
-