Query regarding analysis of Javascript in HTML pages

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)*
    Version : 8.2 ,CE
    SonarQube Scanner : 4.0.0.1744

  • what are you trying to achieve
    I have a webpage which is part of Oracle Webcentre application. It has html pages with embedded javascript and css.
    I observed that while html and css issues are shown in Sonarqube dashboard, none of the javascript issues are shown. I thought at least there will be some code smells in javascript functions. Those are not auto generated functions. This is observed for 3 projects.
    So question is does Sonarqube analyses javascript embedded in html pages.

  • what have you tried so far to achieve this
    I tried setting sonar.language=html,js while performing the analysis. Logs snapshot below

11:47:02 11:47:02.489 INFO: Indexing files…
11:47:02 11:47:02.490 INFO: Project configuration:
11:47:02 11:47:02.490 INFO: Excluded sources: **/*.xml
11:47:02 11:47:02.502 DEBUG: ‘mypage.html’ indexed with language ‘web’
11:47:04 11:47:04.151 DEBUG: ‘SonarCSS Metrics’ skipped because there is no related file in current project
11:47:04 11:47:04.152 DEBUG: ‘Import of stylelint issues’ skipped because there is no related file in current project
11:47:04 11:47:04.155 DEBUG: ‘Import of Android Lint issues’ skipped because one of the required properties is missing
11:47:04 11:47:04.156 DEBUG: ‘JavaScript analysis’ skipped because there is no related file in current project
11:47:05 11:47:05.659 INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=1488ms
11:47:05 11:47:05.662 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
11:47:05 11:47:05.663 INFO: Sensor HTML [web]
11:47:05 11:47:05.779 DEBUG: HtmlSensor: mypage.html: 12,0,1

Thanks
Vishnu

1 Like