False Positive S4654: CSS @font-feature-values custom properties flagged incorrectly

Using the SonarLint “SonarQube for IDE” VSCode extension (SonarSource.sonarlint-vscode, version: 4.29.0), many false positives are reported for CSS @font-feature-values custom properties. Also, it’s currently impossible to use the NOSONAR comment directive to disable the rule with: /* NOSONAR css:S4654 */

Example SonarLint false-positive warnings:

Unexpected unknown property "classic"
Unexpected unknown property "closed"
Unexpected unknown property "broken-equals-ligatures"
Unexpected unknown property "hi-f"
Unexpected unknown property "curly-t"
Unexpected unknown property "curly-j"
Unexpected unknown property "curly-l"
Unexpected unknown property "short-w"
Unexpected unknown property "sharp-k"
Unexpected unknown property "curly-y"
Unexpected unknown property "split-dollarsign"
Unexpected unknown property "hl-cyrillic-c"

Example @font-feature-values CSS that triggers the false-positives:

/* NOSONAR css:S4654 */
@font-feature-values "JetBrainsMono Nerd Font Propo" {
	/* Match my VSCode config:
	   JetBrainsMono OpenType features:
	   "editor.fontLigatures": "'cv02', 'cv04', 'cv05', 'cv07', 'cv08', 'cv11', 'cv14', 'cv99', 'ss19', 'zero', 'calt',
	   // FiraCode OpenType features:
	   'ss04', 'ss08', 'ss09', 'cv23'"
	*/
	@styleset {
		classic: 1; /* ss01 – Classic construction. JetBrains Mono but even more neutral. Performs better in big paragraph of text. */
		closed: 2; /* ss02 – Closed construction. Change the rhythm to a more lively one. */
		broken-equals-ligatures: 19; /* ss19 – Adds gaps in ≠ ≠= == === ligatures. */
		hi-f: 20; /* ss20 – Shift horizontal stroke in f to match x-height. */
	}
	@character-variant {
		curly-t: 2; /* cv02 */
		curly-j: 4; /* cv04 */
		curly-l: 5; /* cv05 */
		short-w: 7; /* cv07 */
		sharp-k: 8; /* cv08 */
		curly-y: 11; /* cv11 */
		split-dollarsign: 14; /* cv14 */
		hl-cyrillic-c: 99; /* cv99 */
	}
}

Hi @trinitronx,

thanks for reporting this.

We already have a ticket to fix this.

Cheers

1 Like