From 5ad6733b6ab25613c36220de935ead98ff26af4e Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Mon, 1 Feb 2016 21:56:49 +0100 Subject: [PATCH] Add some lint checks. --- Gruntfile.js | 12 +++++++++++- grunt-config/flake8.js | 5 +++++ grunt-config/htmllint.js | 9 +++++++++ grunt-config/watch.js | 13 ++++++++++++- package.json | 26 ++++++++++++++------------ 5 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 grunt-config/flake8.js create mode 100644 grunt-config/htmllint.js diff --git a/Gruntfile.js b/Gruntfile.js index 2fb011d..eb5391d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -38,14 +38,24 @@ module.exports = function(grunt) { 'wiredep:app', ]); + grunt.registerTask('pydev', [ + 'newer:flake8' + ]); + grunt.registerTask('jsdev', [ 'newer:jshint', 'newer:jscs' ]); + grunt.registerTask('htmldev', [ + 'newer:htmllint' + ]); + grunt.registerTask('dev', [ 'dependencies', - 'jsdev' + 'pydev', + 'jsdev', + 'htmldev' ]); grunt.registerTask('serve', [ diff --git a/grunt-config/flake8.js b/grunt-config/flake8.js new file mode 100644 index 0000000..832647d --- /dev/null +++ b/grunt-config/flake8.js @@ -0,0 +1,5 @@ +module.exports = { + src: [ + 'accountant/**/*.py' + ] +} diff --git a/grunt-config/htmllint.js b/grunt-config/htmllint.js new file mode 100644 index 0000000..afd4c00 --- /dev/null +++ b/grunt-config/htmllint.js @@ -0,0 +1,9 @@ +module.exports = { + frontend: { + options: {}, + src: [ + 'accountant/frontend/templates/**/*.html', + 'accountant/frontend/static/templates/**/*.html' + ] + } +} diff --git a/grunt-config/watch.js b/grunt-config/watch.js index 35208eb..6e9aef0 100644 --- a/grunt-config/watch.js +++ b/grunt-config/watch.js @@ -5,7 +5,18 @@ module.exports = { }, js: { files: '<%= paths.frontend_js %>', - tasks: ['devjs'] + tasks: ['jsdev'] + }, + py: { + files: 'accountant/**/*.py', + tasks: ['pydev'] + }, + html: { + files: [ + 'accountant/frontend/templates/**/*.html', + 'accountant/frontend/static/templates/**/*.html' + ], + tasks: ['htmldev'] }, gruntfile: { files: ['Gruntfile.js'] diff --git a/package.json b/package.json index 459e3a6..ea23514 100644 --- a/package.json +++ b/package.json @@ -4,20 +4,22 @@ "repository": "https://git.lahouze.org/xals/accountant", "license": "AGPL-1.0", "devDependencies": { - "grunt": "0.4.5", + "grunt": "^0.4.5", "grunt-bg-shell": "^2.3.1", - "grunt-contrib-clean": "0.6.0", - "grunt-contrib-concat": "0.5.1", - "grunt-contrib-jshint": "0.11.2", - "grunt-contrib-watch": "0.6.1", - "grunt-copy": "0.1.0", - "grunt-jscs": "^2.6.0", + "grunt-contrib-clean": "^0.7.0", + "grunt-contrib-concat": "^0.5.1", + "grunt-contrib-jshint": "^0.12", + "grunt-contrib-watch": "^0.6.1", + "grunt-copy": "^0.1.0", + "grunt-flake8": "^0.1.3", + "grunt-htmllint": "^0.2.7", + "grunt-jscs": "^2.7.0", "grunt-newer": "^1.1.1", - "grunt-shell": "1.1.2", + "grunt-shell": "^1.1.2", "grunt-wiredep": "^2.0.0", - "jshint-stylish": "2.0.0", - "load-grunt-configs": "0.4.3", - "load-grunt-tasks": "3.2.0", - "time-grunt": "1.2.1" + "jshint-stylish": "^2.1.0", + "load-grunt-configs": "^0.4.3", + "load-grunt-tasks": "^3.2.0", + "time-grunt": "^1.3.0" } }