diff --git a/gulpfile.js b/gulpfile.js index df79ab876..885ffe042 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,8 +10,12 @@ var rename = require('gulp-rename'); var istanbul = require('gulp-istanbul'); var bump = require('gulp-bump'); var tag_version = require('gulp-tag-version'); -var dox = require("gulp-dox"); -var markdown = require("metalsmith-markdown"); +var jshint = require('gulp-jshint'); +var stylish = require('jshint-stylish'); + +var paths = { + scripts: ['./src/*.js'] +}; gulp.task('jison2', function() { return gulp.src('./src/*.jison') @@ -155,3 +159,9 @@ gulp.task('patch', function() { return inc('patch'); }) gulp.task('feature', function() { return inc('minor'); }) gulp.task('release', function() { return inc('major'); }) +// Using gulp-jshint and jshint-stylish +gulp.task('lint', function() { + return gulp.src(paths.scripts) + .pipe(jshint()) + .pipe(jshint.reporter(stylish)); +}); diff --git a/package.json b/package.json index 36355657f..d88628c99 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "gulp-istanbul": "^0.4.0", "gulp-jasmine": "~1.0.1", "gulp-jison": "~1.0.0", + "gulp-jshint": "^1.9.0", "gulp-less": "^1.3.6", "gulp-rename": "~1.2.0", "gulp-shell": "^0.2.10", @@ -37,6 +38,7 @@ "he": "^0.5.0", "jasmine": "~2.0.1", "jison": "~0.4.15", + "jshint-stylish": "^1.0.0", "karma": "~0.12.20", "karma-chrome-launcher": "~0.1.5", "karma-jasmine": "~0.2.1", diff --git a/src/graphDb.js b/src/graphDb.js index 9cfe14d3a..adc2bb3a3 100644 --- a/src/graphDb.js +++ b/src/graphDb.js @@ -55,7 +55,8 @@ exports.addVertex = function (id, text, type, style) { exports.addLink = function (start, end, type, linktext) { //console.log('Got edge', start, end); var edge = {start: start, end: end, type: undefined, text: ''}; - var linktext = type.text; + linktext = type.text; + if (typeof linktext !== 'undefined') { edge.text = linktext; } @@ -204,4 +205,3 @@ exports.clear = function () { exports.defaultStyle = function () { return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"; }; - diff --git a/src/utils.js b/src/utils.js index 170c2861a..d832ccec8 100644 --- a/src/utils.js +++ b/src/utils.js @@ -24,4 +24,4 @@ module.exports.detectType = function(text,a){ } return "graph"; -} \ No newline at end of file +};