com.puppycrawl.tools.checkstyle.checks.header
Class CrossLanguageRegexpHeaderCheck

java.lang.Object
  extended by com.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended by com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended by com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
              extended by com.puppycrawl.tools.checkstyle.checks.header.CrossLanguageRegexpHeaderCheck
All Implemented Interfaces:
Configurable, Contextualizable, FileSetCheck

public final class CrossLanguageRegexpHeaderCheck
extends AbstractFileSetCheck

A FileSetCheck similar to RegexpHeaderCheck, but works for all text files, not just java code.

Author:
lk

Constructor Summary
CrossLanguageRegexpHeaderCheck()
          Creates a new instance and initializes the file extentions to the default value, which represents most of the typical text files that require a copyright header.
 
Method Summary
protected  void finishLocalSetup()
          Checks that required args were specified.
 void process(File[] aFiles)
          Processes a set of files and fires errors to the MessageDispatcher.
 void setHeader(String aHeader)
          Set the header to check against.
 void setHeaderFile(String aFileName)
          Set the header file to check against.
 void setMultiLines(int[] aList)
          Set the lines numbers to repeat in the header check.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
destroy, filter, fireErrors, getCharset, getMessageCollector, getMessageDispatcher, log, log, setCharset, setFileExtensions, setMessageDispatcher
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setId, setSeverity
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Configurable
configure
 
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable
contextualize
 

Constructor Detail

CrossLanguageRegexpHeaderCheck

public CrossLanguageRegexpHeaderCheck()
Creates a new instance and initializes the file extentions to the default value, which represents most of the typical text files that require a copyright header.

Method Detail

setMultiLines

public void setMultiLines(int[] aList)
Set the lines numbers to repeat in the header check.

Parameters:
aList - comma separated list of line numbers to repeat in header.

setHeaderFile

public void setHeaderFile(String aFileName)
                   throws ConversionException
Set the header file to check against.

Parameters:
aFileName - the file that contains the header to check against.
Throws:
ConversionException - if the file cannot be loaded

setHeader

public void setHeader(String aHeader)
Set the header to check against. Individual lines in the header must be separated by '\n' characters.

Parameters:
aHeader - header content to check against.
Throws:
ConversionException - if the header cannot be interpreted

finishLocalSetup

protected void finishLocalSetup()
                         throws CheckstyleException
Checks that required args were specified.

Overrides:
finishLocalSetup in class AutomaticBean
Throws:
CheckstyleException - if there is a configuration error.
See Also:
AutomaticBean.finishLocalSetup()

process

public void process(File[] aFiles)
Processes a set of files and fires errors to the MessageDispatcher. The file set to process might contain files that are not interesting to the FileSetCheck. Such files should be ignored, no error message should be fired for them. For example a FileSetCheck that checks java files should ignore html or properties files. Once processiong is done, it is highly recommended to call for the destroy method to close and remove the listeners.

Parameters:
aFiles - the files to be audited.
See Also:
FileSetCheck.destroy()

Back to the Checkstyle Home Page