com.puppycrawl.tools.checkstyle.checks.coding

Class SimplifyBooleanExpressionCheck

public class SimplifyBooleanExpressionCheck extends Check

Checks for overly complicated boolean expressions. Currently finds code like if (b == true), b || true, !false, etc.

Rationale: Complex boolean logic makes code hard to understand and maintain.

An example of how to configure the check is:

 <module name="SimplifyBooleanExpression"/>
 

Author: lkuehne

Method Summary
int[]getAcceptableTokens()
Prevent user from changing tokens in the configuration.
int[]getDefaultTokens()
{@inheritDoc}
int[]getRequiredTokens()
{@inheritDoc}
voidvisitToken(DetailAST aAST)
{@inheritDoc}

Method Detail

getAcceptableTokens

public int[] getAcceptableTokens()
Prevent user from changing tokens in the configuration.

Returns: an empty array.

See Also: Check

getDefaultTokens

public int[] getDefaultTokens()
{@inheritDoc}

getRequiredTokens

public int[] getRequiredTokens()
{@inheritDoc}

visitToken

public void visitToken(DetailAST aAST)
{@inheritDoc}