Skip to content

Commit

Permalink
Issue checkstyle#4073: Use lf_cr_crlf as default for NewlineAtEndOfFi…
Browse files Browse the repository at this point in the history
…le check
  • Loading branch information
Vampire committed Mar 5, 2019
1 parent 0c64cdd commit 6eaac95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Expand Up @@ -71,7 +71,7 @@ public class NewlineAtEndOfFileCheck
public static final String MSG_KEY_NO_NEWLINE_EOF = "noNewlineAtEOF";

/** The line separator to check against. */
private LineSeparatorOption lineSeparator = LineSeparatorOption.SYSTEM;
private LineSeparatorOption lineSeparator = LineSeparatorOption.LF_CR_CRLF;

@Override
protected void processFiltered(File file, FileText fileText) {
Expand Down
Expand Up @@ -21,7 +21,6 @@

import static com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck.MSG_KEY_NO_NEWLINE_EOF;
import static com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck.MSG_KEY_UNABLE_OPEN;
import static java.util.Locale.ENGLISH;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -224,14 +223,8 @@ public int read(byte[] bytes) {
fail("Exception is expected");
}
catch (IOException ex) {
if (System.getProperty("os.name").toLowerCase(ENGLISH).startsWith("windows")) {
assertEquals("Error message is unexpected",
"Unable to read 2 bytes, got 0", ex.getMessage());
}
else {
assertEquals("Error message is unexpected",
"Unable to read 1 bytes, got 0", ex.getMessage());
}
assertEquals("Error message is unexpected",
"Unable to read 1 bytes, got 0", ex.getMessage());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/xdocs/config_misc.xml
Expand Up @@ -1236,7 +1236,7 @@ void foo(String aFooString,
<td>lineSeparator</td>
<td>type of line separator</td>
<td><a href="property_types.html#lineSeparator">Line Separator Policy</a></td>
<td>system</td>
<td>lf_cr_crlf</td>
<td>3.1</td>
</tr>
<tr>
Expand Down

0 comments on commit 6eaac95

Please sign in to comment.