SonarTS is not able to analyse typescript files

Template for a good new topic, formatted with Markdown:

  • ALM used GitHub

  • CI system Jenkins

  • Scanner command - sonar-scanner (SonarQube Scanner 4.0.0.1744)

  • Languages JavaScript,TypeScript

  • Error observed

 INFO: Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.

While running sonar-scanner and sending reports to sonarqube developer edition 8.1, I am getting this error and typescript files are not analyzed, this was working on community edition 7.9.1.
SonarJS plugin in sonarqube node - sonar-javascript-plugin-6.1.0.11503.jar
SonarTS plugin in sonarqube noe - sonar-typescript-plugin-2.1.0.4359.jar

Hi,

This log is just a note, that actual analysis will be done by SonarJS plugin. Could you share full logs of analysis to understand why TS analysis is missing?

1 Like

@Lena @Tibin_George_Kuriyan Possibly related to the same issue I’m seeing

Has only happened recently, seems others are reporting it here too - I’ve raised a bug on Github too, also included logs

@Lena

Attaching sonar-scanner logs in debug mode.
https://filebin.net/yishlycgatp4dwrh/logs.txt?t=b9yg9810

Log part where it says typescript analysis is skipped

07:02:26.797 INFO: Sensor SonarTS [typescript]
07:02:26.797 INFO: Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
07:02:26.797 INFO: Sensor SonarTS [typescript] (done) | time=0ms
List of plugins from the above logs
07:01:04.524 DEBUG: Plugins:
07:01:04.525 DEBUG:   * SonarCSS 1.1.1.1010 (cssfamily)
07:01:04.525 DEBUG:   * Svn 1.9.0.1295 (scmsvn)
07:01:04.525 DEBUG:   * SonarPLSQL 3.4.1.2576 (plsql)
07:01:04.525 DEBUG:   * SonarScala 1.5.0.315 (sonarscala)
07:01:04.525 DEBUG:   * SonarC# 8.1.0.13383 (csharp)
07:01:04.526 DEBUG:   * Vulnerability Analysis 8.1.0.675 (security)
07:01:04.527 DEBUG:   * SonarJava 5.14.0.18788 (java)
07:01:04.527 DEBUG:   * SonarHTML 3.2.0.2082 (web)
07:01:04.527 DEBUG:   * SonarFlex 2.5.1.1831 (flex)
07:01:04.527 DEBUG:   * SonarXML 2.0.1.2020 (xml)
07:01:04.527 DEBUG:   * SonarTS 2.1.0.4359 (typescript)
07:01:04.527 DEBUG:   * SonarVB 8.1.0.13383 (vbnet)
07:01:04.527 DEBUG:   * SonarSwift 4.2.2.77 (swift)
07:01:04.527 DEBUG:   * SonarCFamily 6.5.0.12506 (cpp)
07:01:04.527 DEBUG:   * SonarPython 2.3.0.5351 (python)
07:01:04.527 DEBUG:   * Google Authentication for SonarQube 1.6.1 (authgoogleoauth)
07:01:04.528 DEBUG:   * JaCoCo 1.0.2.475 (jacoco)
07:01:04.528 DEBUG:   * SonarGo 1.6.0.719 (go)
07:01:04.528 DEBUG:   * SonarKotlin 1.5.0.315 (kotlin)
07:01:04.528 DEBUG:   * SonarTSQL 1.4.0.3334 (tsql)
07:01:04.528 DEBUG:   * SonarJS 6.3.0-SNAPSHOT (javascript)
07:01:04.529 DEBUG:   * SonarRuby 1.5.0.315 (ruby)
07:01:04.530 DEBUG:   * Vulnerability Rules for C# 8.1.0.675 (securitycsharpfrontend)
07:01:04.530 DEBUG:   * Vulnerability Rules for Java 8.1.0.675 (securityjavafrontend)
07:01:04.530 DEBUG:   * License for SonarLint 8.1.0.31237 (license)
07:01:04.530 DEBUG:   * Vulnerability Rules for Python 8.1.0.675 (securitypythonfrontend)
07:01:04.531 DEBUG:   * Git 1.9.1.1834 (scmgit)
07:01:04.534 DEBUG:   * SonarPHP 3.3.0.5166 (php)
07:01:04.534 DEBUG:   * SonarABAP 3.8.0.2034 (abap)
07:01:04.534 DEBUG:   * Vulnerability Rules for PHP 8.1.0.675 (securityphpfrontend)
07:03:36.109 INFO: Sensor TypeScript analysis [javascript]

That’s the line where the interesting long starts. So the problem is that most of your TS files are not matching any tsconfig file, we are not analyzing those.

07:03:37.498 INFO: Skipping 157 files with no tsconfig.json

So check that for each TS file there is at least one tsconfig.json in one of the directories above.