Skip to content

Commit

Permalink
Merge f035c6b into 16e829e
Browse files Browse the repository at this point in the history
  • Loading branch information
damianszczepanik committed Feb 4, 2015
2 parents 16e829e + f035c6b commit f91aa4f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class ConfusingConditionCheck extends Check {
* Allow to ignore "else" block if its length is in
* "multiplyFactorForElseBlocks" time less then "if" block.
*/
private static int multiplyFactorForElseBlocks = MULTIPLY_FACTOR_FOR_ELSE_BLOCK;
private int multiplyFactorForElseBlocks = MULTIPLY_FACTOR_FOR_ELSE_BLOCK;

/**
* Disable warnings for all "if" that follows the "else". It is useful for
Expand Down Expand Up @@ -148,7 +148,7 @@ public void setIgnoreThrowInElse(final boolean ignoreThrowInElse) {
* @see ConfusingConditionCheck#MultiplyFactorForElseBlocks
*/
public void setMultiplyFactorForElseBlocks(int multiplyFactorForElseBlocks) {
this.multiplyFactorForElseBlocks = multiplyFactorForElseBlocks;
multiplyFactorForElseBlocks = multiplyFactorForElseBlocks;
}

@Override
Expand Down Expand Up @@ -229,7 +229,7 @@ private static boolean isElseWithThrow(DetailAST literalIf) {
* @param literalIf
* @return If the condition is met (true) |Isn't men (false).
*/
private static boolean isRatioBetweenIfAndElseBlockSuitable(DetailAST literalIf) {
private boolean isRatioBetweenIfAndElseBlockSuitable(DetailAST literalIf) {
boolean result = true;

final DetailAST lastChildAfterIf = literalIf.getLastChild();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package com.github.sevntu.checkstyle.checks.coding;

import static com.github.sevntu.checkstyle.checks.coding.ConfusingConditionCheck.*;
import static com.github.sevntu.checkstyle.checks.coding.ConfusingConditionCheck.MSG_KEY;

import org.junit.Test;

Expand All @@ -33,11 +33,17 @@ public class ConfusingConditionCheckTest extends BaseCheckTestSupport

private final String warningMessage = getCheckMessage(MSG_KEY);

private final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class);

@Test
public void testDefault()
throws Exception
public void testDefault() throws Exception
{
final DefaultConfiguration checkConfig = createCheckConfig(ConfusingConditionCheck.class);
checkConfig.addAttribute("ignoreInnerIf", "true");
checkConfig.addAttribute("ignoreNullCaseInIf", "true");
checkConfig.addAttribute("ignoreSequentialIf", "true");
checkConfig.addAttribute("ignoreThrowInElse", "true");
checkConfig.addAttribute("multiplyFactorForElseBlocks", "4");

final String[] expected = {
"10: " + warningMessage,
"13: " + warningMessage,
Expand Down

0 comments on commit f91aa4f

Please sign in to comment.