Issues Importing ESLint Report for Angular WebApp in a Maven-Spring Boot Project

Hi everyone,

I’m facing an issue when trying to integrate ESLint reports into SonarQube for an Angular web application that’s part of a larger Maven-managed Spring Boot project. Here’s a breakdown of my setup and the problem:

Project Structure:

  • Spring Boot apps under /app/config, /app/zookeeper, etc.
  • Angular webapp located under /app/webapp/src/main/web.
  • Build Management: Maven.
  • Sonar Analysis Tool: Using Sonar Scanner for Maven in GitLab CI.

SonarQube Configuration:

  1. In the pom.xml under /app/webapp, I’ve set the following property to include the Angular app in the analysis:

    <properties>
        <sonar.sources>src/main/web</sonar.sources>
    </properties>
    
  2. Additionally, I import an eslint_report.json generated from a previous GitLab CI job using the following Sonar property:

    <properties>
        <sonar.eslint.reportPaths>eslint_report.json</sonar.eslint.reportPaths>
    </properties>
    

Problem:

  • From the logs, it appears that SonarQube is correctly analyzing the webapp files:
[INFO] 06:58:34.127 TypeScript configuration file /builds/sti/app/noe/app/webapp/src/main/web/tsconfig.json
[INFO] 06:58:34.128 328 source files to be analyzed
[INFO] 06:58:42.934 Starting analysis with current program
[INFO] 06:58:44.130 1/328 file analyzed, current file: app/webapp/src/main/web/src/app/modules/pages/dashboard/dashboard.service.ts
[INFO] 06:58:54.131 22/328 files analyzed, current file: app/webapp/src/main/web/src/app/modules/shared/components/groups-lazy-autocomplete/is-selected.pipe.ts
...
[INFO] 06:59:55.354 Analyzed 328 file(s) with current program
  • However, when SonarQube attempts to import the ESLint report, it returns a warning for every file included in the report:
[INFO] 07:00:15.622 Sensor Import of ESLint issues [javascript]
[INFO] 07:00:15.623 Importing /builds/sti/app/noe/app/webapp/src/main/web/eslint_report.json
[WARNING] 07:00:15.647 No input file found for /builds/sti/app/noe/app/webapp/src/main/web/src/app/app.module.ts. No ESLint issues will be imported on this file.
[WARNING] 07:00:15.648 No input file found for /builds/sti/app/noe/app/webapp/src/main/web/src/app/modules/pages/mechanical-rescue/permission/add-edit-permission-dialog/add-edit-permission-dialog.component.html. No ESLint issues will be imported on this file.
...
[WARNING] 07:00:15.648 No input file found for /builds/sti/app/noe/app/webapp/src/main/web/src/app/modules/pages/mechanical-rescue/vehicle-rescue/vehicle-rescue.service.ts. No ESLint issues will be imported on this file.

What I’ve Tried:

  • Double-checked the paths in both the ESLint report and the SonarQube configuration to ensure they match.
  • Ensured that the eslint_report.json is correctly generated in the previous CI step.

Environment:

  • SonarQube: 10.5.1
  • GitLab: 16.8.2
  • ESLint: 8.57
  • Sonar Scanner: Maven plugin

Questions:

  • Has anyone encountered similar issues when integrating ESLint reports for an Angular webapp within a larger Spring Boot project managed by Maven?
  • Is there a known issue with SonarQube ESLint report import or configuration I might have missed?
  • Do I need to modify any other settings in SonarQube, Maven, or the ESLint report to properly include the files?

Any help or hints would be greatly appreciated!

Thanks in advance!

[Update]
For anyone who has encountered a similar problem, in my case i resolved setting the property

<sonar.sources>.</sonar.sources>
<sonar.inclusions>src/main/**</sonar.inclusions>

into the main project’s pom.xml.

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