SCSS css:S5362 invalid "malformed calc() function"

Template for a good new topic, formatted with Markdown:

  • Github Code and CI
  • CSS Rule css:S5362

Hello there,
since a few days sonarcloud.io complains about lines of scss being valid for years.

$imgLargeWidth: pxToRem(121);
width: calc(100% - #{$imgLargeWidth} - #{pxToRem(20)});

Complaint is “Fix this malformed ‘calc’ expression.”

Sadly //NOSONAR did not work and it blocks our pipeline so that we were forced to disable the rule completely. Has anyone else encountered this problem?

So long

1 Like

Hello Stefan,

Welcome to the Sonar community, and thank you for your feedback!

The rule you are referring to was recently rewritten from scratch. To give you a bit of context, we use Stylelint under the hood. In that regard, we used to borrow their implementation of the rule from Stylelint. However, in a recent release, they decided to drop the rule.

Now, coming back to your feedback, it seems that our new implementation of the rule may emit false positives when dealing with some scss-specific syntaxes. I created this ticket to track this issue and address these false positives as soon as possible.

Thank you,
Yassin

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