Don't see tslint report into SonarCloud

I’d like to import tslint report into SonarCloud. I do see relevant lines into my scan log, but don’t see these issues into Sonar. What I’m missing?

INFO: Sensor Import of TSLint issues [javascript]
INFO: Importing xxxxx/reports/tslint-report.json
INFO: Sensor Import of TSLint issues [javascript] (done) | time=520ms

My sonar.properties includes

sonar.ts.tslintconfigpath=tslint.json
sonar.typescript.tslint.reportPaths=reports/tslint-report.json

Hello Vitaly,

So first the property sonar.ts.tslintconfigpath belongs to Pablissimo’s ts plugin, so you won’t be able to use this on SonarCloud.

About sonar.typescript.tslint.reportPaths it seems to be correctly configured. But I need to verify if we still support that. Because, as I explained to you in a previous thread, SonarTS has been deprecated and is not used anymore on SonarCloud and I’m not sure if this setting is still supported by SonarJS. I’ll come back to you as soon as I have the answer.

And regarding tslint, you should know that it’s being deprecated and the tslint maintainers are working on eslint now instead. So you might want to import eslint reports instead of investing time into tslint.

Gregoire, thank you.
Yes, I remember your answer to my previous question.
But my customer already has tslint profile and asked me to integrate it to Sonar.

1 Like

Hi,

It’s not clear why it does not work for you, the only idea I have in mind is that your report file is empty.

And btw this property sonar.ts.tslintconfigpath is not used by our analyzer, you can drop it.

1 Like

Than you both, I removed sonar.ts.tslintconfigpath from my Sonar scanner config. As for tslint report - by setting ‘max-line-length’ low into tslint.json I generated a lot of alerts in tslint report.
In general - should I see linter report under “Overview” section on the Sonar portal?

Are you sure your tslint report is not empty? (I believe that tslint generates a lot of issues but are they written into the report file)

External issues should be displayed along with other regular issues: on overview page and in issues tab.

I prefer do not share our tslint report in the forum, will be glad to send you via PM.

I’m not asking to show report, just asking you to verify it’s not empty and contains expected issues.

Yes, it’s JSON file produced by running ‘tslint -t json -o tslint-report.json’, please see below its header:

[
  {
    "endPosition": {
      "character": 117,
      "line": 0,
      "position": 117
    },
    "failure": "Exceeds maximum line length of 90",
    "name": "/var/lib/jenkins/workspace/......./Service.ts",
    "ruleName": "max-line-length",
    "ruleSeverity": "ERROR",
    "startPosition": {
      "character": 0,
      "line": 0,
      "position": 0
    }
  },

I don’t see any reason why TSLint issues might be missing from analysis :frowning: I created a ticket to improve logging so that with next release of analyzer we will have more info -> https://github.com/SonarSource/SonarJS/issues/1840

1 Like