We have Sonarqube 10.3 installed in our server and when analyze a project with scss files it throws s4662 issue.
The line with issue is:
@use '@angular/material' as mat;
But that line is ok according to material documentation:
I asume it’s a false positive. Could you check this please?
You are right, the
@use rule that you mention is perfectly valid and should not be flagged as an issue. That said, I was not able to reproduce the problem. Can you please tell us more about your SonarQube setup and your project?
- The build of SonarQube 10.3 you are using
- The name of the SASS file that exhibits the issue
- The path of this SASS file relative to your project root
Thanks in advance,
The Issue is in one of our angular projects.
- Build of Sonarqube: 10.3.0.82913
- Name of the Sass file: themeMG.scss
- Path: src/app/shared/theme/themeMG.scss
I hope this helps you to solve the problem
Thank you very much
Thanks for the information. We checked internally and I can confirm that the
@use at-rule is whitelisted in the “Sonar way” default Quality Profile. Can you please check if your project is using a custom Quality Profile that does not whitelist this at-rule?
You can easily check this by clicking on the Rules tab, searching for “S4662” and looking at the list of Quality profiles that this rule is included in. Typically, I was able to reproduce your issue by creating a custom Quality profile and removing the “use” token from the
ignoreAtRules parameter, as you can see in the following screenshots:
Yes, we use a custom quality profile and I have checked that “use” isn’t whitelisted in.
Thank you very much for your quickly resolution.
You’re welcome, I’m glad your issue was solved.