SonarCloud Throwing NumberFormatException for Angular Project

Hi,

I’m currently facing a strange behavior in Sonar for Angular Project. This and few other similar errors are thrown in component templates:

java.lang.NumberFormatException: For input string: "{{index}}"

we are using Azure DevOps Pipelines, and we Have 2 tasks:

  • SonarCloudPrepare
  • SonarCloudAnalyze

In SonarCloudPrepare we are configuring sonar settings with the following:

        sonar.sourceEncoding=utf-8
        sonar.typescript.tsconfigPath = tsconfig.app.json
        sonar.exclusions=**/*.svg,**/*.png,**/*.ico,**/*.css,**/*.spec.ts,**/*.js,**/node_modules/**,**/e2e/**,**/coverage/**,**/*.ttf
        sonar.coverageReportPaths=$(Agent.TempDirectory)/mergedcoveragereport/SonarQube.xml
        sonar.log.level=DEBUG
        sonar.verbose=true
        set SONAR_SCANNER_OPTS="-Xmx8G"

Any clue what the above error indicates and how to solve it?

TIA…

Hey there.

Can you provide the full logs from the task throwing that error?

Hi Colin, thanks for the quick reply. here is the log output from SonarCloudAnalyze task.

sonar-logs.txt (2.3 MB)

Thanks!

Could you share any one of the files where this error is throwing?

Such as this one:

src/shared/components/general-toolbar-dropdown-user/general-toolbar-dropdown-user.component.html

It looks like a problem in our HTML analyzer. With a file that reproduces the issue, I can pass it onto the right team.

Hi Colin, please find the attached file.

filters-dropdown.zip (4.3 KB)

Thanks…

@ikamel92, welcome to the community and thanks a lot for your valuable report and the code samples. Thanks to them, we were able to confirm and identify the issue. We created an internal ticket to have it fixed as soon as possible.

You can track its progress there.