Class RegexpMultilineCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck
- All Implemented Interfaces:
Configurable,Contextualizable,FileSetCheck
Checks that a specified pattern matches across multiple lines in any file type.
Rationale: This check can be used to when the regular expression can be span multiple lines.
- Since:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
AbstractAutomaticBean.OutputStreamOptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MultilineDetectorThe detector to use.private StringSpecify the format of the regular expression to match.private booleanControl whether to ignore case when searching.private booleanControl whether to match expressions across multiple lines.private intSpecify the maximum number of matches required in each file.private StringSpecify the message which is used to notify about violations, if empty then default (hard-coded) message is used.private intSpecify the minimum number of matches required in each file. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginProcessing(String charset) Called when about to be called to process a set of files.private intRetrieves the compile-flags for the regular expression being built based onmatchAcrossLines.protected voidprocessFiltered(File file, FileText fileText) Called to process a file that matches the specified file extensions.voidSetter to specify the format of the regular expression to match.voidsetIgnoreCase(boolean ignoreCase) Setter to control whether to ignore case when searching.voidsetMatchAcrossLines(boolean matchAcrossLines) Setter to control whether to match expressions across multiple lines.voidsetMaximum(int maximum) Setter to specify the maximum number of matches required in each file.voidsetMessage(String message) Setter to specify the message which is used to notify about violations, if empty then default (hard-coded) message is used.voidsetMinimum(int minimum) Setter to specify the minimum number of matches required in each file.Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
addViolations, destroy, finishProcessing, fireErrors, getFileContents, getFileExtensions, getMessageDispatcher, getTabWidth, getViolations, init, log, log, process, setFileContents, setFileExtensions, setMessageDispatcher, setTabWidthMethods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityMethods inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
configure, contextualize, getConfiguration, setupChildMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.puppycrawl.tools.checkstyle.api.Configurable
configureMethods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable
contextualize
-
Field Details
-
format
Specify the format of the regular expression to match. -
message
Specify the message which is used to notify about violations, if empty then default (hard-coded) message is used. -
minimum
Specify the minimum number of matches required in each file. -
maximum
Specify the maximum number of matches required in each file. -
ignoreCase
Control whether to ignore case when searching. -
matchAcrossLines
Control whether to match expressions across multiple lines. -
detector
The detector to use.
-
-
Constructor Details
-
RegexpMultilineCheck
public RegexpMultilineCheck()
-
-
Method Details
-
beginProcessing
Description copied from interface:FileSetCheckCalled when about to be called to process a set of files.- Specified by:
beginProcessingin interfaceFileSetCheck- Overrides:
beginProcessingin classAbstractFileSetCheck- Parameters:
charset- the character set used to read the files.
-
processFiltered
Description copied from class:AbstractFileSetCheckCalled to process a file that matches the specified file extensions.- Specified by:
processFilteredin classAbstractFileSetCheck- Parameters:
file- the file to be processedfileText- the contents of the file.
-
getRegexCompileFlags
Retrieves the compile-flags for the regular expression being built based onmatchAcrossLines.- Returns:
- The compile-flags.
-
setFormat
Setter to specify the format of the regular expression to match.- Parameters:
format- the format of the regular expression to match.- Since:
- 5.0
-
setMessage
Setter to specify the message which is used to notify about violations, if empty then default (hard-coded) message is used.- Parameters:
message- the message to report for a match.- Since:
- 5.0
-
setMinimum
Setter to specify the minimum number of matches required in each file.- Parameters:
minimum- the minimum number of matches required in each file.- Since:
- 5.0
-
setMaximum
Setter to specify the maximum number of matches required in each file.- Parameters:
maximum- the maximum number of matches required in each file.- Since:
- 5.0
-
setIgnoreCase
Setter to control whether to ignore case when searching.- Parameters:
ignoreCase- whether to ignore case when searching.- Since:
- 5.0
-
setMatchAcrossLines
Setter to control whether to match expressions across multiple lines.- Parameters:
matchAcrossLines- whether to match expressions across multiple lines.- Since:
- 8.25
-