Skip to content

Commit

Permalink
feat(Rules): rules repository upgrade + fixed unit tests for rules re…
Browse files Browse the repository at this point in the history
…numbering
  • Loading branch information
Gilles Grousset committed May 27, 2024
1 parent 994bf41 commit 08c7fcb
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<jacoco.version>0.8.11</jacoco.version>

<!-- Temporary version waiting for real automatic release in ecocode repository -->
<ecocode-rules-specifications.version>1.5.0</ecocode-rules-specifications.version>
<ecocode-rules-specifications.version>1.5.4</ecocode-rules-specifications.version>

</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testRegisteredRules() {
public void assertRuleProperties() {
Rule rule = repository.rule("EC603");
assertThat(rule).isNotNull();
assertThat(rule.name()).isEqualTo("Animation Methods in UIKit and SwiftUI");
assertThat(rule.name()).isEqualTo("Animation Free");
assertThat(rule.debtRemediationFunction().type()).isEqualTo(Type.CONSTANT_ISSUE);
assertThat(rule.debtRemediationFunction().baseEffort()).isEqualTo("5min");
assertThat(rule.type()).isEqualTo(RuleType.CODE_SMELL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Geo_trigger() {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC522");
assertThat(i.ruleKey().rule()).isEqualTo("EC524");

assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void rigidAlarmCheck_trigger() {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC506");
assertThat(i.ruleKey().rule()).isEqualTo("EC509");
assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void motionSensorRate_trigger() {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC547");
assertThat(i.ruleKey().rule()).isEqualTo("EC534");
assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void chargeAwareness_trigger(String filePath, int lineNumber) {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC602");
assertThat(i.ruleKey().rule()).isEqualTo("EC519");
assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(lineNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void saveModeAwareness_trigger(String filePath, int lineNumber) {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC543");
assertThat(i.ruleKey().rule()).isEqualTo("EC520");
assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(lineNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void brightnessOverrideTrigger() {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC523");
assertThat(i.ruleKey().rule()).isEqualTo("EC522");
assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(11);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void locationUpdatesPausesDisabled_trigger() {
assertThat(context.allIssues()).hasSize(1);
Optional<Issue> issue = context.allIssues().stream().findFirst();
issue.ifPresent(i -> {
assertThat(i.ruleKey().rule()).isEqualTo("EC521");
assertThat(i.ruleKey().rule()).isEqualTo("EC533");
assertThat(i.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = i.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void assertTorchIssue(String file, int line) {
}

private void assertIssue(Issue issue, int line) {
assertThat(issue.ruleKey().rule()).isEqualTo("EC503");
assertThat(issue.ruleKey().rule()).isEqualTo("EC530");
assertThat(issue.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = issue.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(line);
Expand Down

0 comments on commit 08c7fcb

Please sign in to comment.