Skip to content

Commit

Permalink
Fix backwards incompatible change in SonarLint metadata file (#3712)
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck authored Feb 16, 2023
1 parent ebc205f commit f58ba51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import org.sonar.plugins.javascript.JavaScriptLanguage;
import org.sonar.plugins.javascript.JavaScriptProfilesDefinition;
import org.sonar.plugins.javascript.api.EslintBasedCheck;
import org.sonar.plugins.javascript.api.JavaScriptCheck;
import org.sonar.plugins.javascript.css.CssProfileDefinition;
import org.sonar.plugins.javascript.css.CssRules;
import org.sonar.plugins.javascript.css.CssRulesDefinition;
Expand Down Expand Up @@ -175,7 +174,7 @@ static class Rule {
private RuleStatus status = RuleStatus.defaultStatus();
private Set<String> tags;
private List<RulesDefinition.Param> params;
private List<Object> defaultParams;
private List<Object> defaultParams = Collections.emptyList();
private RuleScope scope;
private String eslintKey;
private boolean activatedByDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
import org.sonar.javascript.checks.StringLiteralsQuotesCheck;
import org.sonar.plugins.javascript.JavaScriptProfilesDefinition;
import org.sonar.plugins.javascript.css.CssProfileDefinition;
import org.sonar.plugins.javascript.css.CssRules;
import org.sonar.plugins.javascript.css.CssRulesDefinition;
import org.sonar.plugins.javascript.css.rules.AtRuleNoUnknown;
import org.sonar.plugins.javascript.rules.JavaScriptRulesDefinition;

import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;

class RulesMetadataForSonarLintTest {
Expand Down Expand Up @@ -156,6 +154,8 @@ void test_all() throws Exception {
.map(element -> element.getAsJsonObject().get("scope").getAsString())
.collect(Collectors.toSet());
assertThat(scopes).isEqualTo(Set.of("ALL", "MAIN", "TEST"));

assertThat(jsonArray).extracting(j -> j.getAsJsonObject().get("defaultParams")).doesNotContainNull();
}

}

0 comments on commit f58ba51

Please sign in to comment.