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

Fails on correctly-formatted tslint report #32

Closed EarthCitizen closed 8 years ago

EarthCitizen commented 8 years ago

I have the following tslint report:

[{
    "endPosition": {
        "character": 6,
        "line": 22,
        "position": 885
    },
    "failure": "block is empty",
    "name": "src/file.ts",
    "ruleName": "no-empty",
    "startPosition": {
        "character": 4,
        "line": 22,
        "position": 883
    }
}]

When running Sonar I get the following error:

Caused by: fr.sii.sonar.report.core.common.exception.ProviderException: failed to parse json file. Cause: Can not deserialize instance of fr.sii.sonar.report.core.quality.domain.report.QualityReport out of START_ARRAY token
 at [Source: java.io.InputStreamReader@4407f129; line: 1, column: 1]
    at fr.sii.sonar.report.core.common.provider.JsonFileReportProvider.get(JsonFileReportProvider.java:55)
    at fr.sii.sonar.report.core.common.ReportSensor.analyse(ReportSensor.java:106)
    ... 91 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of fr.sii.sonar.report.core.quality.domain.report.QualityReport out of START_ARRAY token
 at [Source: java.io.InputStreamReader@4407f129; line: 1, column: 1]
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:854)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:850)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1257)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:155)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:134)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3731)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2778)
    at fr.sii.sonar.report.core.common.provider.JsonFileReportProvider.get(JsonFileReportProvider.java:51)
    ... 92 more

Looking at the code, it seems that the plug-in is not properly set up to consume tslint JSON.

aurelien-baudet commented 8 years ago

Hi,

The plugin doesn't take the report directly generated by TSLint. You have to use our own gulp tasks (see https://github.com/groupe-sii/sonar-web-frontend-reporters) that generates a more complete report.

EarthCitizen commented 8 years ago

OK. It might be a good idea to change this line in the README.md to be a little more specific:

"The reports are either directly produced by the tools or by our gulp tasks."

As it is, it sounds like the tslint generated reports would be directly consumable.