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), 'lf' (unix) and 'lf_cr_crlf' (lf, cr or crlf).
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description | 
|---|---|
static String | 
MSG_KEY_NO_NEWLINE_EOF
A key is pointing to the warning message text in "messages.properties"
 file. 
 | 
static String | 
MSG_KEY_UNABLE_OPEN
A key is pointing to the warning message text in "messages.properties"
 file. 
 | 
| Constructor and Description | 
|---|
NewlineAtEndOfFileCheck()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
processFiltered(File file,
               FileText fileText)
Called to process a file that matches the specified file extensions. 
 | 
void | 
setLineSeparator(String lineSeparatorParam)
Sets the line separator to one of 'crlf', 'lf','cr', 'lf_cr_crlf' or 'system'. 
 | 
addMessages, beginProcessing, destroy, finishProcessing, fireErrors, getFileExtensions, getMessageDispatcher, init, log, log, process, setFileExtensions, setMessageDispatcherfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconfigurecontextualizepublic static final String MSG_KEY_UNABLE_OPEN
public static final String MSG_KEY_NO_NEWLINE_EOF
public NewlineAtEndOfFileCheck()
protected void processFiltered(File file, FileText fileText)
AbstractFileSetCheckprocessFiltered in class AbstractFileSetCheckfile - the file to be processedfileText - the contents of the file.public void setLineSeparator(String lineSeparatorParam)
lineSeparatorParam - The line separator to setIllegalArgumentException - If the specified line separator is not
         one of 'crlf', 'lf', 'cr', 'lf_cr_crlf' or 'system'Copyright © 2001–2018. All rights reserved.