Disparity between Lines and Lines of Code - Javascript and Typescript files

  • ALM used: Github
  • CI system used: CircleCI
  • Languages of the repository: JS and TS
  • Only if the SonarCloud project is public, the URL: SonarCloud

As others on this forum (see links below) only JS Javascript files of the project are included in Lines of Code.
TS Typescript files are only recognized as Linues.

Background Task ID: AXoT2QN3k_WGqhJSj_sl

The project is a Yarn Workspace and mono-repo built with Lerna.

How to analyze the Typescript files?

Thank you.

Hey there.

In your case Typescript files fail to be analyzed for the following reason:

ERROR: File '@sindresorhus/tsconfig' not found.
INFO: Skipping 1261 files with no tsconfig.json

Indeed, the root tsconfig file your other files extend from only exist once a command like this is run:

npm install --save-dev @sindresorhus/tsconfig

Are you using Automatic Analysis or triggering your analysis through your CI tool (and the execution of sonar-scanner)

This one.
Should I switch to sonar-scanner?

Any idea @Colin?

Hey @dlecan

Sorry this thread fell off my radar!

Yes, switching to CI-based analysis where the tsconfig.json files are available (because you’ve run npm install or whatever you use to grab this module containing the tsconfig.json file before analysis) would fix the issue.

You could also try having the tsconfig.json file available in your repo so it’s picked up by automatic analysis, but I’m guessing that’s not ideal.

Long-term, we may allow analysis without the tsconfig of the project (although not necessarily targeted for this use-case)

I think it’s an interesting situation. I’ll ping the right team internally for awareness of this scenario.

1 Like

Ok, I will switch
thank you

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