Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error thrown by the checkstyle #40

Closed
william26 opened this issue Jul 7, 2015 · 1 comment
Closed

Error thrown by the checkstyle #40

william26 opened this issue Jul 7, 2015 · 1 comment

Comments

@william26
Copy link

I encountered the following unhandled error when no scss issues are found:

TypeError: Cannot read property 'forEach' of undefined
at [...]/node_modules/gulp-scss-lint/src/checkstyle.js:12:27

This error seems to occur when using the Checkstyle reporter like this:

return gulp
    .src([
      config.appStyles
    ])
    // SCSS lint:
    .pipe(scssLint({
      reporterOutputFormat: 'Checkstyle',
      filePipeOutput: 'scss-report.xml'
    }))
    .pipe(gulp.dest('reports/lint'));

The problem disappears when setting a default value to report.checkstyle.file in src/checkstyle.js:12:

  xml2js(xmlReport, function(err, report) {
    report.checkstyle.file = report.checkstyle.file || []; // Here
    report.checkstyle.file.forEach(function(file) {
        obj[file.$.name] = [];

        file.error.forEach(function(error) {
          error.$.linter = error.$.source;
          error.$.reason = error.$.message;

          obj[file.$.name].push(error.$);
        })
    });

    cb(obj, xmlReport);
  });
@juanfran
Copy link
Owner

juanfran commented Jul 7, 2015

fixed in version 0.2.1, thank you very much!

@juanfran juanfran closed this as completed Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants