SonarTsPlugin icon indicating copy to clipboard operation
SonarTsPlugin copied to clipboard

Improve TypeScript support

Open bcaudan opened this issue 8 years ago • 6 comments

Is there any plan to add in this plugin features like:

  • syntax highlighting
  • code duplications

as described in https://docs.sonarqube.org/display/DEV/Supporting+New+Languages?

bcaudan avatar Apr 05 '17 15:04 bcaudan

I'd like to support both, but certainly the first would require me to write and maintain a TypeScript parser to do the highlighting which is an order of magnitude more overhead than I'm willing to take on.

Duplications I think you can do without a parser though, or at least have a decent bash at.

Pablissimo avatar Apr 06 '17 09:04 Pablissimo

@Pablissimo maybe you could use some libraries from typescript itself? Microsoft tries to make reusable instruments, like ie. language-server. Java can run javascript through nashorn.

Duplications typically need a lexer output. It's not hard to write own (~50 LOC or so + separeted small channel for string literals), but i hope something can be found at MS side

nixel2007 avatar Apr 06 '17 10:04 nixel2007

Worth looking at for sure - having access to the language service stuff underpinning the actual TS compiler would also allow better parsing of LCOV coverage data, avoiding flagging non-executable lines as covered or not which relates to another issue around here somewhere...

Pablissimo avatar Apr 06 '17 10:04 Pablissimo

For duplication, the project below use JSCPD: https://github.com/kucherenko/jscpd

https://github.com/groupe-sii/sonar-web-frontend-reporters https://github.com/groupe-sii/sonar-web-frontend-plugin

Worth a look. A collaboration would be nice as they don't support Sonar 6. But it is fully featured so we are using it with Sonar 4.5 and get all reports including test coverage for Typescript.

aecz avatar May 06 '17 20:05 aecz

@Pablissimo just want to point you to https://github.com/SonarSource/SonarTS-Plugin/commits/master

~it's alive!~ some commits included

nixel2007 avatar Jul 18 '17 15:07 nixel2007

Thanks! Sorry, been away from non-work development for a bit. Indeed - I need to have a chat with them and see what their roadmap is.

Pablissimo avatar Aug 06 '17 10:08 Pablissimo