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

Update S4649 ('font-family-no-missing-generic-family-keyword'): Support 'ignoreFontFamilies' option #3095

Merged
merged 4 commits into from
Apr 12, 2022

Conversation

yassin-kammoun-sonarsource
Copy link
Contributor


@Rule(key = "S4649")
public class FontFamilyNoMissingGenericFamilyKeyword implements CssRule {

private static final String DEFAULT_IGNORE_FONT_FAMILIES = "custom-font";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not put example into default value


@RuleProperty(
key = "ignoreFontFamilies",
description = "Comma-separated list of regular expressions for font families exempt from this rule.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As not only regex are support but also plain strings I would rephrase: Comma-separated list of font families exempt from this rule (regular expressions supported).

Copy link
Contributor

@vilchik-elena vilchik-elena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove default value

@@ -142,7 +142,7 @@ void declaration_block_no_duplicate_properties_custom() {
@Test
void font_family_no_missing_generic_family_keyword_default() {
String optionsAsJson = new Gson().toJson(new FontFamilyNoMissingGenericFamilyKeyword().stylelintOptions());
assertThat(optionsAsJson).isEqualTo("[true,{\"ignoreFontFamilies\":[\"custom-font\"]}]");
assertThat(optionsAsJson).isEqualTo("[true,{\"ignoreFontFamilies\":[\"\"]}]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm.. usually we have non-empty default, so we didn't have such problem before, but I believe we should have an empty array here, and not array with empty string literal.

@sonarsource-next
Copy link

sonarsource-next bot commented Apr 11, 2022

@vilchik-elena vilchik-elena merged commit eedcd56 into master Apr 12, 2022
@vilchik-elena vilchik-elena deleted the sonar-css/issue-356 branch April 12, 2022 07:50
@farashaikh
Copy link

@vilchik-elena I am using SonarQube 9.4 and I can still see this issue
image

Please can you let me know if this update is available in version 9.4?

@vilchik-elena
Copy link
Contributor

vilchik-elena commented Jun 24, 2022

@farashaikh this change only adds a parameter for the rule. You should set it to the values you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants