Failed to parse some CSS files in sonarqube 7.6

Hi,
I’m using sonarqube developer 7.6. Some CSS files are failed to parse in sonarqube analysis stage. Sonarqube did analysis on .js and .css file but few files failed to parse. I can see some bugs on CSS files.

Please help me on this.

Could you add some examples? It is impossible to help you without any data.

Only few CSS files getting this error.

15:01:56 ------------- Run sensors on module
15:01:56 Sensor SonarCSS Metrics [cssfamily]
15:01:57 Sensor SonarCSS Metrics [cssfamily] (done) | time=939ms
15:01:57 Sensor SonarCSS Rules [cssfamily]
15:02:09 Failed to parse file:///E:/test.css
15:02:09 Failed to parse file:///E:/sample/a.css
15:02:09 Failed to parse file:///E:/sample/ab.css
15:02:09 Failed to parse file:///E:/sample/exp3.css
15:02:09 Failed to parse file:///E:/sample/exp2.css
15:02:09 Failed to parse file:///E:/sample/exp1.css
15:02:09 Failed to parse file:///E:/sample/ie7.css
15:02:09 Failed to parse file:///E:/sample/main.css
15:02:09 Failed to parse file:///E:/sample/.css
15:02:09 Failed to parse file:///E:/teammed.css

@agabrys

The console output showing as above only.

These paths looks invalid. How did you configure Sonar Scanner (sonar-project.properties file or other build tool configuration)?

@agabrys

I used classpath “org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7”
and I used sonarqube property in build.gradle
property “sonar.nodejs.executable”, “E:/nodejs/node.exe”
property “sonar.css.node”, “E:/nodejs/node.exe”

In same module did analysis on other files only few of them getting parse error.

Are you sure that these files complaint CSS standard (see CSS Validation Service)?

Check also if encoding is correct, and you didn’t add BOM.

I’m using gradle 4.4.1 as build tool. when I validate css file in css validator it has few parse errors. But in our case few files are not considering for sonar analysis.
I can see CSS related bugs in dashboard.
Please verify @agabrys

For my knowledge SonarCSS supports only CSS code (as the name suggests). If you use any other technologies in .css files then the analyzer is not able to parse those files. The same situation you get if you for example store HTML code in .java, or PHP in .cpp files.

You have only two otpions:

  1. exclude those files from analysis scope
  2. change extension to different than .css

Sure Adam.

Thanks!