Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ClassComplexityCheck and NestedStatementsCheck #1065

Merged
merged 2 commits into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static List<Class> getChecks() {
CycleBetweenPackagesCheck.class,
DuplicatedIncludeCheck.class,
FileComplexityCheck.class,
ClassComplexityCheck.class,
FileHeaderCheck.class,
FileEncodingCheck.class,
FileRegularExpressionCheck.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public class ClassComplexityCheck extends SquidCheck<Grammar> {

private static final int DEFAULT_MAXIMUM_CLASS_COMPLEXITY_THRESHOLD = 60;

@RuleProperty(key = "maximumClassComplexityThreshold", defaultValue = "" + DEFAULT_MAXIMUM_CLASS_COMPLEXITY_THRESHOLD)
@RuleProperty(
key = "maximumClassComplexityThreshold",
description = "Max value of complexity allowed in a class",
defaultValue = "" + DEFAULT_MAXIMUM_CLASS_COMPLEXITY_THRESHOLD)
private int maximumClassComplexityThreshold = DEFAULT_MAXIMUM_CLASS_COMPLEXITY_THRESHOLD;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ public class NestedStatementsCheck extends SquidCheck<Grammar> {

private static final String ELSE_TOKEN = "ELSE";

@RuleProperty(defaultValue = "" + DEFAULT_MAX,
description = "Maximum allowed control flow statement nesting depth.")
@RuleProperty(
key = "max",
description = "Maximum allowed control flow statement nesting depth.",
defaultValue = "" + DEFAULT_MAX)
public int max = DEFAULT_MAX;

private final Set<AstNode> checkedNodes = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public class CheckListTest {

@Test
public void count() {
assertThat(CheckList.getChecks().size()).isEqualTo(45);
assertThat(CheckList.getChecks().size()).isEqualTo(46);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public void rulesTest() {
new CxxRuleRepository().define(context);

assertThat(context.repositories()).hasSize(1);
assertThat(context.repository(CheckList.REPOSITORY_KEY).rules()).hasSize(45);
assertThat(context.repository(CheckList.REPOSITORY_KEY).rules()).hasSize(46);
}
}