com.puppycrawl.tools.checkstyle.checks

Class NewlineAtEndOfFileCheck

Implemented Interfaces:
Configurable, Contextualizable, FileSetCheck

public class NewlineAtEndOfFileCheck
extends AbstractFileSetCheck

Checks that there is a newline at the end of each file.

An example of how to configure the check is:

 <module name="NewlineAtEndOfFile"/>

This will check against the platform-specific default line separator.

It is also possible to enforce the use of a specific line-separator across platforms, with the 'lineSeparator' property:

 <module name="NewlineAtEndOfFile">
   <property name="lineSeparator" value="lf"/>
 </module>

Valid values for the 'lineSeparator' property are 'system' (system default), 'crlf' (windows), 'cr' (mac) and 'lf' (unix).

Version:
1.0

Authors:
Christopher Lenz
lkuehne

Method Summary

void
process(File[] aFiles)
void
setLineSeparator(String aLineSeparator)
Sets the line separator to one of 'crlf', 'lf' or 'cr'.

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

getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Method Details

process

public void process(File[] aFiles)
Specified by:
process in interface FileSetCheck

See Also:
FileSetCheck.process(File[])


setLineSeparator

public void setLineSeparator(String aLineSeparator)
Sets the line separator to one of 'crlf', 'lf' or 'cr'.

Parameters:
aLineSeparator - The line separator to set