Closed fatihi closed 3 years ago
A couple of notes from me:
TypeScript analysis for SonarQube was migrated to JavaScript analyzer. SonarTS is a legacy repository which is used to produce an artifact required for backward compatibility with SonarQube.
SonarJs is now the one true ring, I mean JavaScript Parser. It's mostly written in Java, but requires Node >= 8 to run:
If standard node is not available, you have to set property sonar.nodejs.executable to an absolute path to Node.js executable.
So please provide a helpful error message if the user does not have node installed or the version is too old.
But where can we start implementing this? I really don't know but I have some ideas.
JavaScriptSensorTest and JavaScriptSensor which has an execute
Method, that takes a Context and analyses files. The Context is part of the Sonar Batch Api and can return metrics. In our very own SourceCodeParser we pass a SensorContextTester to the JavasquidSensor and then call context.allIssues()
to retrieve all issues :) That might help you get started. You should probably take the opportunity to remove the SensorContextTester though, because that is not part of the Api and shouldn't be used according to the docs.
I hope the above helps you get started. I don't know how and when the code calls node. I also don't know if it just looks on the classpath or it expects node the be bundled. The pom.xml
uses the shade-plugin for something strange.
Superseded by #1885. That parser is going to be able to parse many more languages.
Feature request
The SourceCodeParser can currently parse Java source code thanks to SonarJava.
Description
To make it even easier for projects to get started with CodeCharta we could add SonarTS to the SourceCodeParser as well.