Skip to content

Commit

Permalink
Merge pull request #929 from motlin/whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
motlin authored Jul 28, 2020
2 parents 8980b43 + 3f584e1 commit 4aa7e39
Show file tree
Hide file tree
Showing 28 changed files with 244 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
java-version: [8]
java-version: [11]

runs-on: ${{ matrix.os }}

Expand Down
9 changes: 8 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 103 additions & 26 deletions checkstyle-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,56 +86,112 @@

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForInitializerPad" />
<module name="EmptyForIteratorPad">
<property name="option" value="space" />
</module>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true" />
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false" />
</module>
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoLineWrap" />
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS" />
<property name="tokens" value="ARRAY_INIT" />
<property name="tokens" value="AT" />
<property name="tokens" value="BNOT" />
<property name="tokens" value="DEC" />
<property name="tokens" value="DOT" />
<property name="tokens" value="INC" />
<property name="tokens" value="LNOT" />
<property name="tokens" value="UNARY_MINUS" />
<property name="tokens" value="UNARY_PLUS" />
<property name="tokens" value="ARRAY_DECLARATOR" />
<property name="tokens" value="INDEX_OP" />
<property name="tokens" value="METHOD_REF" />
</module>

<module name="NoWhitespaceBefore" />
<module name="NoWhitespaceBefore">
<property name="tokens" value="DOT" />
<property name="tokens" value="METHOD_REF" />
<property name="allowLineBreaks" value="true" />
</module>

<module name="OperatorWrap">
<property name="tokens" value="ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN, BOR_ASSIGN, BAND_ASSIGN" />
<property name="option" value="eol" />
<property name="tokens" value="QUESTION" />
<property name="tokens" value="COLON" />
<property name="tokens" value="EQUAL" />
<property name="tokens" value="NOT_EQUAL" />
<property name="tokens" value="DIV" />
<property name="tokens" value="PLUS" />
<property name="tokens" value="MINUS" />
<property name="tokens" value="STAR" />
<property name="tokens" value="MOD" />
<property name="tokens" value="SR" />
<property name="tokens" value="BSR" />
<property name="tokens" value="GE" />
<property name="tokens" value="GT" />
<property name="tokens" value="SL" />
<property name="tokens" value="LE" />
<property name="tokens" value="LT" />
<property name="tokens" value="BXOR" />
<property name="tokens" value="BOR" />
<property name="tokens" value="LOR" />
<property name="tokens" value="BAND" />
<property name="tokens" value="LAND" />
<property name="tokens" value="TYPE_EXTENSION_AND" />
<property name="tokens" value="LITERAL_INSTANCEOF" />
<property name="tokens" value="METHOD_REF" />
<property name="option" value="nl" />
</module>

<module name="OperatorWrap">
<property name="tokens" value="QUESTION, COLON, EQUAL, NOT_EQUAL, DIV, PLUS, MINUS, STAR, MOD, SR, BSR, GE, GT, SL, LE, LT, BXOR, BOR, LOR, BAND, LAND, LITERAL_INSTANCEOF, TYPE_EXTENSION_AND, METHOD_REF" />
<property name="option" value="nl" />
<property name="tokens" value="ASSIGN" />
<property name="tokens" value="DIV_ASSIGN" />
<property name="tokens" value="PLUS_ASSIGN" />
<property name="tokens" value="MINUS_ASSIGN" />
<property name="tokens" value="STAR_ASSIGN" />
<property name="tokens" value="MOD_ASSIGN" />
<property name="tokens" value="SR_ASSIGN" />
<property name="tokens" value="BSR_ASSIGN" />
<property name="tokens" value="SL_ASSIGN" />
<property name="tokens" value="BXOR_ASSIGN" />
<property name="tokens" value="BOR_ASSIGN" />
<property name="tokens" value="BAND_ASSIGN" />
<property name="option" value="eol" />
</module>

<module name="ParenPad" />

<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapNl" />
<property name="tokens" value="DOT" />
<property name="tokens" value="AT" />
<property name="tokens" value="METHOD_REF" />
<property name="option" value="nl" />
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapEol" />
<property name="tokens" value="COMMA" />
<property name="tokens" value="RPAREN" />
<property name="tokens" value="RBRACK" />
<property name="tokens" value="ARRAY_DECLARATOR" />
<property name="tokens" value="ELLIPSIS" />
<property name="tokens" value="SEMI" />
<property name="option" value="EOL" />
</module>
<module name="TypecastParenPad" />

<module name="WhitespaceAfter" />

<module name="WhitespaceAround">
<property
name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND" />
<property name="allowEmptyConstructors" value="true" />
<property name="allowEmptyMethods" value="true" />
<property name="allowEmptyTypes" value="true" />
<property name="allowEmptyLoops" value="true" />
</module>

<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true" />
</module>

<module name="SeparatorWrap">
<property name="tokens" value="DOT" />
<property name="option" value="nl" />
</module>

<module name="SeparatorWrap">
<property name="tokens" value="COMMA, RPAREN" />
<property name="option" value="EOL" />
</module>

<module name="Indentation">
<property name="lineWrappingIndentation" value="8"/>
</module>
Expand Down Expand Up @@ -236,10 +292,33 @@
value="System.err.println." />
</module>

<module name="RegexpSinglelineJava">
<property name="ignoreComments" value="true" />

<property
name="format"
value=", \w+,\n" />

<property
name="message"
value="Comma separated list should have one item per line, or be all on a single line." />
</module>

<module name="RegexpSinglelineJava">
<property name="ignoreComments" value="true" />

<property
name="format"
value="\(\w+,\n" />

<property
name="message"
value="Comma separated list should have one item per line, or be all on a single line." />
</module>

<!-- Effective Java Item 6 - Avoid finalizers -->
<module name="NoFinalizer" />

<module name="GenericWhitespace" />
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases" />
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF" />
Expand Down Expand Up @@ -300,8 +379,6 @@

<module name="OneTopLevelClass" />

<module name="NoLineWrap" />

<module name="UnusedImports">
<property name="processJavadoc" value="true" />
</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public interface Immutable<name>List extends Immutable<name>Collection, <name>Li
@Override
default \<V> ImmutableList\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public interface Mutable<name>List extends Mutable<name>Collection, <name>List
@Override
default \<V> MutableList\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public interface <name>List extends Reversible<name>Iterable
@Override
default \<V> ListIterable\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public interface Ordered<name>Iterable extends <name>Iterable
*/
default \<V> OrderedIterable\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand All @@ -63,7 +63,7 @@ public interface Ordered<name>Iterable extends <name>Iterable
*/
default \<V, R extends Collection\<V\>> R collectWithIndex(<name>IntToObjectFunction\<? extends V> function, R target)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++), target);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface Reversible<name>Iterable extends Ordered<name>Iterable
@Override
default \<V> ReversibleIterable\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public interface Immutable<name>Stack extends <name>Stack
@Override
default \<V> ImmutableStack\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public interface Mutable<name>Stack extends <name>Stack
@Override
default \<V> MutableStack\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public interface <name>Stack extends Ordered<name>Iterable
@Override
default \<V> StackIterable\<V> collectWithIndex(<name>IntToObjectFunction\<? extends V> function)
{
int[] index = { 0 };
int[] index = {0};
return this.collect(each -> function.value(each, index[0]++));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ import org.junit.Test;
*/
public class <name>BooleanHashMapKeysViewTest
{
private final Lazy<name>Iterable iterable = <name>BooleanHashMap.newWithKeysValues(<(literal.(type))("0")>, true, <(literal.(type))("1")>, false, <(literal.(type))("31")>, true,
generateCollisions1().getFirst(), false).withKeyValue(generateCollisions1().get(1), true).keysView();
private final Lazy<name>Iterable iterable = <name>BooleanHashMap
.newWithKeysValues(
<(literal.(type))("0")>, true,
<(literal.(type))("1")>, false,
<(literal.(type))("31")>, true,
generateCollisions1().getFirst(), false)
.withKeyValue(generateCollisions1().get(1), true)
.keysView();

private static <name>ArrayList generateCollisions1()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public class UnmodifiableObject<name>MapValuesTest extends AbstractMutable<name>
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void removeAll_iterable()
{
this.newWith().removeAll(new <name>ArrayList());
Expand All @@ -181,14 +181,14 @@ public class UnmodifiableObject<name>MapValuesTest extends AbstractMutable<name>
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void retainAll_iterable()
{
this.newWith().retainAll(new <name>ArrayList());
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void clear()
{
Mutable<name>Collection emptyCollection = this.newWith();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,35 +197,35 @@ public class Unmodifiable<name>BooleanMapValuesTest extends AbstractMutableBoole
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void removeAll()
{
this.newWith().removeAll();
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void removeAll_iterable()
{
this.newWith().removeAll(BooleanArrayList.newListWith(false, true));
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void retainAll()
{
this.newWith().retainAll();
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void retainAll_iterable()
{
this.newWith().retainAll(BooleanArrayList.newListWith(false, true));
}

@Override
@Test (expected = UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void clear()
{
MutableBooleanCollection emptyCollection = this.newWith();
Expand Down
Loading

0 comments on commit 4aa7e39

Please sign in to comment.