MaibornWolff / codecharta

CodeCharta is a visualization tool that transforms complex software architecture and code metrics into interactive, customizable visual maps, empowering everyone to communicate and analyze your codebase. Improve code quality, maintainability, and architectural decisions
https://maibornwolff.github.io/codecharta/
BSD 3-Clause "New" or "Revised" License
195 stars 30 forks source link

Add TypeScript & JavaScript Support to SourceCodeParser #801

Closed fatihi closed 3 years ago

fatihi commented 5 years ago

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.

Richargh commented 4 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.

BridgeAR commented 3 years ago

Superseded by #1885. That parser is going to be able to parse many more languages.