css:S4650 "calc" operands should be correctly spaced

Versions used
SonarQube 8.0.0.29455
SonarCSS 1.2 (build 1325)

The rule “css:S4650 “calc” operands should be correctly spaced” is incorrectly flagging
width: calc(1*(2px + 0.75rem + 1.5em));
as a blocker.

With reference to W3C CSS Values and Units Module Level 3 section 8.1.1 Syntax

"In addition, [white space] is required on both sides of the [+] and - operators. (The [*] and / operaters can be used without white space around them.)"

This is flagging a number of issues in our code bases most problematically in third party references that we cannot easily modify.

Thanks

Nick

Hello Nick,

Thank you for the feedback, and welcome to SonarSource community!

Indeed, the rule should not flag occurrences of * and / operators without white spaces around them. In that regard, I created the following ticket to address this false positive.

Side note: you should avoir analysing third party references since you don’t own the corresponding sources and cannot easily modify them.

Best,
Yassin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.