groupe-sii / sonar-web-frontend-plugin

Sonar plugin to add metrics for web technologies (JS, CSS, HTML, SASS, AngularJS...)
Apache License 2.0
115 stars 26 forks source link

tslint does not produce valid JSON for multiple files #31

Open EarthCitizen opened 8 years ago

EarthCitizen commented 8 years ago

If the plugin handles this situation, then this is a non-issue, but tslint does not output valid JSON when multiple files are given for one run. For example:

tslint -t json 'src/**/*.ts'

This produces output like so:

[{"endPosition":{"character":6,"line":22,"position":885},"failure":"block is empty","name":"src/file1.ts","ruleName":"no-empty","startPosition":{"character":4,"line":22,"position":883}}][{"endPosition":{"character":50,"line":23,"position":1169},"failure":"block is empty","name":"src/file2.ts","ruleName":"no-empty","startPosition":{"character":6,"line":39,"position":1593}}]

Which is not valid JSON as it creates a [] for each file.

This is a known issue with tslint. But as long as tslint has this issue, then this plugin will have to work around that you just want to fail on the JSON parse.

I did not actually try to see what the plugin does in this case, but I wanted to make this situation known in case it was not already. So, if this is already handled, then this can just be closed.

aurelien-baudet commented 8 years ago

Hello,

You need to use our tslintReporter that is available here : https://github.com/groupe-sii/sonar-web-frontend-reporters. We don't consume directly tslint report as it is missing some required information.