Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#588 Header check has to distinguis source file-type

Oliver Burn
Jörg Hohwiller

In your own documentation at
you say "Different programming languages have different comment syntax rules".
However I can not find a way to tell checks such as Header or RegexpHeader to work only on .java Files.
My header is multiline / ... / comment that can not be used in properties-files.
However checkstyle complains about the missing header in properties-files.
Either documentation is missing importation information or there is an important feature missing in checkstyle to
be able to allow different Filters for different file-formats.


  • Lars Kühne
    Lars Kühne

    If the propertíes file should contain a header as well, only in a different comment format, you can use something similiar to the Apache example in the RegexpHeader docs, you only have to adjust the regular expressions a bit.

    I assume that is not what you intend, and you want to limit the file header check to java files only. I haven't tried this, but you should be able to do that by specifying the property "fileExtensions" to "java". This is supported by most (all?) checks that have Checker as their parent module, it is implemented in the AbstractFileSetCheck baseclass (see API docs).

    You are correct that this property is not documented in the end user documentation, leaving this issue open.

  • Oliver Burn
    Oliver Burn

    As usual Lars is 100% right. Just do something like:

    <module name="Header">
    <property name="headerFile" value="java.header"/>
    <property name="ignoreLines" value="2, 3, 4"/>
    <property name="fileExtensions" value="java"/>

    Fixed documentation - SVN revision 2506