groupe-sii / sonar-web-frontend-reporters

This is a repo of SII continuous integration build system dedicated to Front-end webapps.
22 stars 10 forks source link

SaveException: The file doesn't exist #9

Open merjadok opened 8 years ago

merjadok commented 8 years ago

Hello,

We are getting a following error when running the TS analysis for our project:

INFO: Sensor Lines Sensor
INFO: Sensor Lines Sensor (done) | time=0ms
INFO: Sensor TslintQualitySensor
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 36.876s
INFO: Final Memory: 55M/511M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
fr.sii.sonar.report.core.common.exception.SaveException: The file frontend\mobile\custom_typings\file.ts doesn't exist
    at fr.sii.sonar.report.core.common.util.FileUtil.checkMissing(FileUtil.java:239)
    at fr.sii.sonar.report.core.common.util.FileUtil.checkMissing(FileUtil.java:106)
    at fr.sii.sonar.report.core.quality.save.QualitySaver.save(QualitySaver.java:42)
    at fr.sii.sonar.report.core.quality.save.QualitySaver.save(QualitySaver.java:28)
    at fr.sii.sonar.report.core.common.ReportSensor.analyse(ReportSensor.java:106)
...

We have the following structure

\---sonar-project.properties
+---src
|   +---backend
|   +---frontend
|   |   +---mobile
|   |   |   +---custom_typings
|   |   |   |   \---file.ts
|   |   +---reports
|   |   |   +---sonar
|   |   |   |   \---tslint.json

This is how we configured the Gulp task:

gulp.task('sonar', function() {
    return SonarWebReporters.launchReporters({
        project: 'Project',
        css : false,
        js : false,
        eslint : false,
        eslint_angular: false,
        html: false,
        ts: {
          src: [
            '**/*.ts',
            '!node_modules/**/*',
            '!common/jspm_packages/**/*',
            '!mobile/jspm_packages/**/*',
            '!webortal/jspm_packages/**/*'
          ],
          report: "reports/sonar/tslint.json",
          rulesFile: "../tslint.json",
          task: "ci-tslint",
          linter: require("gulp-tslint")
        }
    });
});

and this is the output we get in reports/sonar/tslint.json (just part of it):

{
"language" : "reports/sonar/tslint.json",
"project" : "Project",
"projectPath" : ".",
"version" : "1.1.0",
"files" : [{
    "name" : "file.ts",
    "path" : "mobile\\custom_typings\\file.ts",
    "nbLines" : 1711,
    "nbComments" : 0,
    "nbCloc" : 1574,
    ...

It seems that paths are somehow wrong but I cannot find any configuration which actually works. Am I doing something obviously wrong here?

Thanks in advance and best regards,

merjadok commented 8 years ago

I have even tried manually changing the path to absolute path (in reports/sonar/tslint.json):

C:\Jenkins\workspace\sonarQube\src\frontend\mobile\custom_typings\file.ts

but I still get the same error:

fr.sii.sonar.report.core.common.exception.SaveException: The file C:\\Jenkins\\workspace\\sonarQube\\src\\frontend\\mobile\\custom_typings\\file.ts doesn't exist

cedric-legallo commented 7 years ago

This is a sonar plugin issue : https://github.com/groupe-sii/sonar-web-frontend-plugin. it seems like a bug we had by the past on other linters, either the bug is present for TS or it is fixed and the problem comes from your sonar configuration. Is the sonar.properties configuration correct ? (sonar.sources should be src/frontend or src.frontend for your project)

anandhasubha commented 7 years ago

Looks like the problem is with the name of the file. I renamed the rules (aka config) file from .tslintrc to tsrules.json and it worked. The tslint plugin might be expecting a json file instead of .tslintrc file.