Automating Pylint (and other Python Tasks) can be achieved with several viable python-based methods, but what if we used Gulp.js? The following code snippet gathers runs Pylint on the set of python files defined by pySource.
var gulp = require('gulp'), shell = require('gulp-shell'); gulp.task("pylint", function() { log('Linting with pylint -> creating report file.'); var files = []; gulp.src(pySource, {read: true}) .on('data', function(file) { files.push(file.path); }) .on('data', function() { shell.task(['pylint ' + files.join(' ') + ' -f parseable > pylint_report.txt'], {quiet: true, ignoreErrors: true})(); }); });
Notes:
- This is just a first cut. I may find a better way.
- I am aware that I could have simply used gulp-shell to call pylint with a collection of directories.
- I am open to feedback on this. Let me know if I’m doing something wrong or inefficient.