com.puppycrawl.tools.checkstyle
Class Configuration
java.lang.Object
|
+--com.puppycrawl.tools.checkstyle.Configuration
- All Implemented Interfaces:
- Defn, java.io.Serializable
- public class Configuration
- extends java.lang.Object
- implements Defn, java.io.Serializable
Represents the configuration that checkstyle uses when checking.
- Author:
- Oliver Burn
- See Also:
- Serialized Form
Fields inherited from interface com.puppycrawl.tools.checkstyle.Defn |
ALLOW_NO_AUTHOR_PROP, ALLOW_PACKAGE_PROP, ALLOW_PROTECTED_PROP, ALLOW_TABS_PROP, CACHE_FILE_PROP, CONST_PATTERN_PROP, HEADER_FILE_PROP, HEADER_IGNORE_LINE_PROP, HEADER_LINES_REGEXP_PROP, IGNORE_BRACES_PROP, IGNORE_CAST_WHITESPACE_PROP, IGNORE_IMPORT_LENGTH_PROP, IGNORE_IMPORTS_PROP, IGNORE_LINE_LENGTH_PATTERN_PROP, IGNORE_PUBLIC_IN_INTERFACE_PROP, IGNORE_WHITESPACE_PROP, ILLEGAL_IMPORTS_PROP, JAVADOC_CHECKSCOPE_PROP, LCURLY_METHOD_PROP, LCURLY_OTHER_PROP, LCURLY_TYPE_PROP, LOCAL_VAR_PATTERN_PROP, MAX_CONSTRUCTOR_LENGTH_PROP, MAX_FILE_LENGTH_PROP, MAX_LINE_LENGTH_PROP, MAX_METHOD_LENGTH_PROP, MEMBER_PATTERN_PROP, METHOD_PATTERN_PROP, PARAMETER_PATTERN_PROP, PAREN_PAD_PROP, PUBLIC_MEMBER_PATTERN_PROP, RCURLY_PROP, REQUIRE_PACKAGE_HTML_PROP, STATIC_PATTERN_PROP, TAB_WIDTH_PROP, TYPE_PATTERN_PROP |
Constructor Summary |
Configuration()
Creates a new Configuration instance. |
Configuration(java.util.Properties aProps,
java.io.PrintStream aLog)
Creates a new Configuration instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Configuration
public Configuration(java.util.Properties aProps,
java.io.PrintStream aLog)
throws org.apache.regexp.RESyntaxException,
java.io.FileNotFoundException,
java.io.IOException
- Creates a new
Configuration
instance.
- Parameters:
aProps
- where to extract configuration parameters fromaLog
- where to log errors to- Throws:
org.apache.regexp.RESyntaxException
- if an error occursjava.io.FileNotFoundException
- if an error occursjava.io.IOException
- if an error occurs
Configuration
public Configuration()
throws java.lang.IllegalStateException
- Creates a new
Configuration
instance.
- Throws:
java.lang.IllegalStateException
- if an error occurs
getParamPat
public java.lang.String getParamPat()
- Returns:
- pattern to match parameters
getParamRegexp
public org.apache.regexp.RE getParamRegexp()
- Returns:
- regexp to match parameters
getStaticPat
public java.lang.String getStaticPat()
- Returns:
- pattern to match static variables
getStaticRegexp
public org.apache.regexp.RE getStaticRegexp()
- Returns:
- regexp to match static variables
getStaticFinalPat
public java.lang.String getStaticFinalPat()
- Returns:
- pattern to match static final variables
getStaticFinalRegexp
public org.apache.regexp.RE getStaticFinalRegexp()
- Returns:
- regexp to match static final variables
getMemberPat
public java.lang.String getMemberPat()
- Returns:
- pattern to match member variables
getMemberRegexp
public org.apache.regexp.RE getMemberRegexp()
- Returns:
- regexp to match member variables
getPublicMemberPat
public java.lang.String getPublicMemberPat()
- Returns:
- pattern to match public member variables
getPublicMemberRegexp
public org.apache.regexp.RE getPublicMemberRegexp()
- Returns:
- regexp to match public member variables
getTypePat
public java.lang.String getTypePat()
- Returns:
- pattern to match type names
getTypeRegexp
public org.apache.regexp.RE getTypeRegexp()
- Returns:
- regexp to match type names
getLocalVarPat
public java.lang.String getLocalVarPat()
- Returns:
- pattern to match local variables
getLocalVarRegexp
public org.apache.regexp.RE getLocalVarRegexp()
- Returns:
- regexp to match local variables
getMethodPat
public java.lang.String getMethodPat()
- Returns:
- pattern to match method names
getMethodRegexp
public org.apache.regexp.RE getMethodRegexp()
- Returns:
- regexp to match method names
getMaxLineLength
public int getMaxLineLength()
- Returns:
- the maximum line length
getMaxMethodLength
public int getMaxMethodLength()
- Returns:
- the maximum method length
getMaxConstructorLength
public int getMaxConstructorLength()
- Returns:
- the maximum constructor length
getMaxFileLength
public int getMaxFileLength()
- Returns:
- the maximum file length
isAllowTabs
public boolean isAllowTabs()
- Returns:
- whether to allow tabs
getTabWidth
public int getTabWidth()
- Returns:
- distance between tab stops
isAllowProtected
public boolean isAllowProtected()
- Returns:
- whether to allow protected data
isAllowPackage
public boolean isAllowPackage()
- Returns:
- whether to allow package data
isAllowNoAuthor
public boolean isAllowNoAuthor()
- Returns:
- whether to allow having no author tag
getJavadocScope
public Scope getJavadocScope()
- Returns:
- visibility scope where Javadoc is checked
isRequirePackageHtml
public boolean isRequirePackageHtml()
- Returns:
- whether javadoc package documentation is required
isIgnoreImports
public boolean isIgnoreImports()
- Returns:
- whether to process imports
getIllegalImports
public java.util.Set getIllegalImports()
- Returns:
- Set of pkg prefixes that are illegal in import statements
getIgnoreLineLengthPat
public java.lang.String getIgnoreLineLengthPat()
- Returns:
- pattern to exclude from line lengh checking
getIgnoreLineLengthRegexp
public org.apache.regexp.RE getIgnoreLineLengthRegexp()
- Returns:
- regexp to exclude from line lengh checking
isIgnoreWhitespace
public boolean isIgnoreWhitespace()
- Returns:
- whether to ignore checks for whitespace
isIgnoreCastWhitespace
public boolean isIgnoreCastWhitespace()
- Returns:
- whether to ignore checks for whitespace after casts
isIgnoreBraces
public boolean isIgnoreBraces()
- Returns:
- whether to ignore checks for braces
isIgnorePublicInInterface
public boolean isIgnorePublicInInterface()
- Returns:
- whether to ignore 'public' keyword in interface definitions
isIgnoreImportLength
public boolean isIgnoreImportLength()
- Returns:
- whether to ignore max line length for import statements
getHeaderLines
public java.lang.String[] getHeaderLines()
- Returns:
- the header lines to check for
getHeaderLinesRegexp
public boolean getHeaderLinesRegexp()
- Returns:
- if lines in header file are regular expressions
getHeaderIgnoreLineNo
public int getHeaderIgnoreLineNo()
- Deprecated. use isHeaderIgnoreLineNo(int) instead
- This method is being kept for API backwards compatibility with
Checkstyle version below
2.1
.
- Returns:
- the first line number to ignore in header
isHeaderIgnoreLineNo
public boolean isHeaderIgnoreLineNo(int aLineNo)
- Parameters:
aLineNo
- a line number- Returns:
- if
aLineNo
is one of the ignored header lines.
getCacheFile
public java.lang.String getCacheFile()
- Returns:
- the name of the cache file
setParamPat
public void setParamPat(java.lang.String aParamPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aParamPat
- pattern to match parameters- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setStaticPat
public void setStaticPat(java.lang.String aStaticPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aStaticPat
- pattern to match static variables- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setStaticFinalPat
public void setStaticFinalPat(java.lang.String aStaticFinalPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aStaticFinalPat
- pattern to match static final variables- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setMemberPat
public void setMemberPat(java.lang.String aMemberPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aMemberPat
- pattern to match member variables- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setPublicMemberPat
public void setPublicMemberPat(java.lang.String aPublicMemberPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aPublicMemberPat
- pattern to match public member variables- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setTypePat
public void setTypePat(java.lang.String aTypePat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aTypePat
- pattern to match type names- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setLocalVarPat
public void setLocalVarPat(java.lang.String aLocalVarPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aLocalVarPat
- pattern to match member variables- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setMethodPat
public void setMethodPat(java.lang.String aMethodPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aMethodPat
- pattern to match method names- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setIgnoreLineLengthPat
public void setIgnoreLineLengthPat(java.lang.String aIgnoreLineLengthPat)
throws org.apache.regexp.RESyntaxException
- Parameters:
aIgnoreLineLengthPat
- pattern to exclude from line legth checking- Throws:
org.apache.regexp.RESyntaxException
- if an error occurs
setMaxLineLength
public void setMaxLineLength(int aMaxLineLength)
- Parameters:
aMaxLineLength
- the maximum line length
setMaxMethodLength
public void setMaxMethodLength(int aMaxMethodLength)
- Parameters:
aMaxMethodLength
- the maximum method length
setMaxConstructorLength
public void setMaxConstructorLength(int aMaxConstructorLength)
- Parameters:
aMaxConstructorLength
- the maximum constructor length
setMaxFileLength
public void setMaxFileLength(int aMaxFileLength)
- Parameters:
aMaxFileLength
- the maximum file length
setIgnoreImportLength
public void setIgnoreImportLength(boolean aIgnoreImportLength)
- Parameters:
aIgnoreImportLength
- whether to allow tabs
setIllegalImports
public void setIllegalImports(java.lang.String aPkgPrefixList)
- Parameters:
aPkgPrefixList
- comma separated list of package prefixes
setAllowTabs
public void setAllowTabs(boolean aAllowTabs)
- Parameters:
aAllowTabs
- whether to allow tabs
setTabWidth
public void setTabWidth(int aTabWidth)
- Parameters:
aTabWidth
- distance between tab stops
setAllowProtected
public void setAllowProtected(boolean aAllowProtected)
- Parameters:
aAllowProtected
- whether to allow protected data
setAllowPackage
public void setAllowPackage(boolean aAllowPackage)
- Parameters:
aAllowPackage
- whether to allow package visible data
setAllowNoAuthor
public void setAllowNoAuthor(boolean aAllowNoAuthor)
- Parameters:
aAllowNoAuthor
- whether to allow having no author tag
setJavadocScope
public void setJavadocScope(Scope aJavadocScope)
- Parameters:
aJavadocScope
- visibility scope where Javadoc is checked
setRequirePackageHtml
public void setRequirePackageHtml(boolean aRequirePackageHtml)
- Parameters:
aRequirePackageHtml
- whether package.html is required
setIgnoreImports
public void setIgnoreImports(boolean aIgnoreImports)
- Parameters:
aIgnoreImports
- whether to process imports
setIgnoreWhitespace
public void setIgnoreWhitespace(boolean aTo)
- Parameters:
aTo
- whether to ignore checks for whitespace
setIgnoreCastWhitespace
public void setIgnoreCastWhitespace(boolean aTo)
- Parameters:
aTo
- whether to ignore checks for whitespace after casts
setIgnoreBraces
public void setIgnoreBraces(boolean aTo)
- Parameters:
aTo
- whether to ignore checks for braces
setIgnorePublicInInterface
public void setIgnorePublicInInterface(boolean aTo)
- Parameters:
aTo
- whether to ignore 'public' in interface definitions
setHeaderFile
public void setHeaderFile(java.lang.String aFileName)
throws java.io.FileNotFoundException,
java.io.IOException
- Parameters:
aFileName
- the header lines to check for- Throws:
java.io.FileNotFoundException
- if an error occursjava.io.IOException
- if an error occurs
setHeaderLinesRegexp
public void setHeaderLinesRegexp(boolean aHeaderLinesRegexp)
- Parameters:
aHeaderLinesRegexp
- lines in header file are regular expressions
setHeaderIgnoreLineNo
public void setHeaderIgnoreLineNo(int aHeaderIgnoreLineNo)
- Deprecated. use setHeaderIgnoreLines(String) instead
- This method is being kept for API backwards compatibility with
Checkstyle version below
2.1
.
- Parameters:
aHeaderIgnoreLineNo
- line number to ignore in header
setHeaderIgnoreLines
public void setHeaderIgnoreLines(java.lang.String aList)
- Parameters:
aList
- comma separated list of line numbers to ignore in header.
setCacheFile
public void setCacheFile(java.lang.String aCacheFile)
- Parameters:
aCacheFile
- name of cache file
getLCurlyMethod
public LeftCurlyOption getLCurlyMethod()
- Returns:
- the left curly placement option for methods
setLCurlyMethod
public void setLCurlyMethod(LeftCurlyOption aTo)
- Parameters:
aTo
- set the left curly placement option for methods
getLCurlyType
public LeftCurlyOption getLCurlyType()
- Returns:
- the left curly placement option for types
setLCurlyType
public void setLCurlyType(LeftCurlyOption aTo)
- Parameters:
aTo
- set the left curly placement option for types
getLCurlyOther
public LeftCurlyOption getLCurlyOther()
- Returns:
- the left curly placement option for others
setLCurlyOther
public void setLCurlyOther(LeftCurlyOption aTo)
- Parameters:
aTo
- set the left curly placement option for others
getRCurly
public RightCurlyOption getRCurly()
- Returns:
- the right curly placement option
setRCurly
public void setRCurly(RightCurlyOption aTo)
- Parameters:
aTo
- set the right curly placement option
getParenPadOption
public PadOption getParenPadOption()
- Returns:
- the parenthesis padding option
setParenPadOption
public void setParenPadOption(PadOption aTo)
- Parameters:
aTo
- set the parenthesis option