Skip to content

Commit

Permalink
Update css:S4653 ('unit-no-unknown'): Drop obsolete hardcoded configu…
Browse files Browse the repository at this point in the history
…ration (#3108)
  • Loading branch information
yassin-kammoun-sonarsource committed Apr 12, 2022
1 parent d10ace6 commit 85722eb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
Expand Up @@ -19,8 +19,6 @@
*/
package org.sonar.plugins.javascript.css.rules;

import java.util.Arrays;
import java.util.List;
import org.sonar.check.Rule;

@Rule(key = "S4653")
Expand All @@ -30,14 +28,4 @@ public class UnitNoUnknown implements CssRule {
public String stylelintKey() {
return "unit-no-unknown";
}

@Override
public List<Object> stylelintOptions() {
return Arrays.asList(true, new StylelintIgnoreOption());
}

private static class StylelintIgnoreOption {
// Used by GSON serialization
private final String[] ignoreUnits = {"x"};
}
}
Expand Up @@ -48,8 +48,7 @@ void rules_default_is_empty() throws NoSuchMethodException, IllegalAccessExcepti
PropertyNoUnknown.class,
SelectorPseudoClassNoUnknown.class,
SelectorPseudoElementNoUnknown.class,
SelectorTypeNoUnknown.class,
UnitNoUnknown.class);
SelectorTypeNoUnknown.class);

for (Class ruleClass : CssRules.getRuleClasses()) {
CssRule rule = (CssRule)ruleClass.getConstructor().newInstance();
Expand Down Expand Up @@ -106,12 +105,6 @@ void selector_pseudo_element_no_unknown_custom() {
assertThat(optionsAsJson).isEqualTo("[true,{\"ignorePseudoElements\":[\"ng-deep\",\"/^custom-/\"]}]");
}

@Test
void units_no_unknown_options() {
String optionsAsJson = new Gson().toJson(new UnitNoUnknown().stylelintOptions());
assertThat(optionsAsJson).isEqualTo("[true,{\"ignoreUnits\":[\"x\"]}]");
}

@Test
void at_rule_unknown_default() {
String optionsAsJson = new Gson().toJson(new AtRuleNoUnknown().stylelintOptions());
Expand Down

0 comments on commit 85722eb

Please sign in to comment.