com.puppycrawl.tools.checkstyle.checks
Class NewlineAtEndOfFileCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck
- All 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
- Author:
- Christopher Lenz, lkuehne
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck |
beginProcessing, destroy, finishProcessing, fireErrors, getMessageCollector, getMessageDispatcher, init, log, log, process, setFileExtensions, setMessageDispatcher |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NewlineAtEndOfFileCheck
public NewlineAtEndOfFileCheck()
processFiltered
protected void processFiltered(File aFile,
List<String> aLines)
- Description copied from class:
AbstractFileSetCheck
- Called to process a file that matches the specified file extensions.
- Specified by:
processFiltered
in class AbstractFileSetCheck
- Parameters:
aFile
- the file to be processedaLines
- an immutable list of the contents of the 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
- Throws:
IllegalArgumentException
- If the specified line separator is not
one of 'crlf', 'lf' or 'cr'
Copyright © 2001-2012. All Rights Reserved.