Skip to content

Scalastyle proposed rules (Whitespace)

Matthew Farwell edited this page Jul 22, 2012 · 7 revisions

This page contains proposed rules for Scalastyle, category Whitespace.

Whitespace

GenericWhitespace

Checks that the whitespace around the Generic tokens [ and ] is correct to the typical convention. For example the following is legal:

val x: List[Integer] = List[Integer]();
val y: List[List[Integer]] = List[List[Integer]]();

But the following example is not:

val x: List [ Integer ] = List [ Integer ] ();
val y: List [ List [ Integer ] ] = List [ List [ Integer ] ] ();

MethodParamPad

Checks the padding between the identifier of a method definition, constructor definition, method call, or constructor invocation; and the left parenthesis of the parameter list. That is, if the identifier and left parenthesis are on the same line, checks whether a space is required immediately after the identifier or such a space is forbidden. If they are not on the same line, reports an error, unless configured to allow line breaks. To allow linebreaks after the identifier, set property allowLineBreaks to true.

NoWhitespaceAfter

Checks that there is no whitespace after a token. More specifically, it checks that it is not followed by whitespace, or (if linebreaks are allowed) all characters on the line after are whitespace. To forbid linebreaks after a token, set property allowLineBreaks to false.

NoWhitespaceBefore

Checks that there is no whitespace before a token. More specifically, it checks that it is not preceded with whitespace, or (if linebreaks are allowed) all characters on the line before are whitespace. To allow linebreaks before a token, set property allowLineBreaks to true.

OperatorWrap

Checks the policy on how to wrap lines on operators.

ParenPad

Checks the policy on the padding of parentheses; i.e. whether a space is required after a left parenthesis and before a right parenthesis, or such spaces are forbidden.

WhitespaceAfter (Partially Done)

Checks that a token is followed by whitespace.

WhitespaceAround

Checks that a token is surrounded by whitespace.