Skip to content

Commit

Permalink
Merge pull request #123 from IcanDivideBy0/reporter_relative_path
Browse files Browse the repository at this point in the history
Use relative file path in reporter
  • Loading branch information
spalger committed Oct 19, 2015
2 parents a380282 + 69c9c17 commit 5b73861
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var path = require('path');
var PluginError = require('gulp-util').PluginError;
var RcLoader = require('rcloader');
var jshintcli = require('jshint/src/cli');
Expand Down Expand Up @@ -40,7 +41,7 @@ module.exports = function createLintFunction(userOpts) {
});

var reportErrors = function (file, out, cfg) {
var filePath = (file.path || 'stdin');
var filePath = file.path ? path.relative(process.cwd(), file.path): 'stdin';

out.results = jshint.errors.map(function (err) {
if (!err) return;
Expand Down
3 changes: 2 additions & 1 deletion src/reporters/fail.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var path = require('path');
var stream = require('../stream');
var PluginError = require('gulp-util').PluginError;
var _ = require('lodash');
Expand Down Expand Up @@ -29,7 +30,7 @@ module.exports = function (opts) {

// check for failure
if (file.jshint && !file.jshint.success && !file.jshint.ignored) {
(fails = fails || []).push(file.path);
(fails = fails || []).push(path.relative(process.cwd(), file.path));
}

// buffer or pass downstream
Expand Down

0 comments on commit 5b73861

Please sign in to comment.