Class RegexpHeaderCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable, ExternalResourceHolder, FileSetCheck

    public class RegexpHeaderCheck
    extends AbstractHeaderCheck
    Checks the header of the source against a header file that contains a regular expression for each line of the source header. In default configuration, if header is not specified, the default value of header is set to null and the check does not rise any violations.
    • Field Detail

      • MSG_HEADER_MISSING

        public static final java.lang.String MSG_HEADER_MISSING
        A key is pointing to the warning message text in "messages.properties" file.
        See Also:
        Constant Field Values
      • MSG_HEADER_MISMATCH

        public static final java.lang.String MSG_HEADER_MISMATCH
        A key is pointing to the warning message text in "messages.properties" file.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RegexpHeaderCheck

        public RegexpHeaderCheck()
    • Method Detail

      • setMultiLines

        public void setMultiLines​(int... list)
        Set the lines numbers to repeat in the header check.
        Parameters:
        list - comma separated list of line numbers to repeat in header.
      • processFiltered

        protected void processFiltered​(java.io.File file,
                                       FileText fileText)
        Description copied from class: AbstractFileSetCheck
        Called to process a file that matches the specified file extensions.
        Specified by:
        processFiltered in class AbstractFileSetCheck
        Parameters:
        file - the file to be processed
        fileText - the contents of the file.
      • setHeader

        public void setHeader​(java.lang.String header)
        Validates the header by compiling it with Pattern.compile(String) and throws IllegalArgumentException if header isn't a valid pattern.
        Overrides:
        setHeader in class AbstractHeaderCheck
        Parameters:
        header - the header value to validate and set (in that order)