#626 Remove blank lines before closing brackets

This commit is contained in:
Andreas Gudian 2015-08-17 23:02:16 +02:00
parent 2c2f69b0d3
commit 71f4a4b2ca
2 changed files with 7 additions and 0 deletions

View File

@ -301,6 +301,9 @@ class IndentationCorrectingWriter extends Writer {
context.indentationLevel++;
return START_OF_LINE;
case '}':
if ( context.consecutiveLineBreaks > 0 ) {
context.consecutiveLineBreaks = 0; // remove previous blank lines
}
case ')':
context.indentationLevel--;
return START_OF_LINE;

View File

@ -43,6 +43,10 @@
<property name="format" value="(\r\n\r\n\r\n|\r\r\r|\n\n\n)" />
<property name="message" value="There are multiple blank lines" />
</module>
<module name="RegexpMultiline">
<property name="format" value="(\r\n\r\n\ *\}|\r\r *\}|\n\n *\})" />
<property name="message" value="There are blank lines before a closing bracket" />
</module>
<module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. -->