You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/06/21 19:37:44 UTC
[2/2] js commit: [all] CB-3960 Move jshint into grunt (lamely)
(cherry picked from commit 3d81324b9d89c8f51b14e2152eec5bfbea094caa)
[all] CB-3960 Move jshint into grunt (lamely)
(cherry picked from commit 3d81324b9d89c8f51b14e2152eec5bfbea094caa)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/2cdca713
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/2cdca713
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/2cdca713
Branch: refs/heads/3.0.0
Commit: 2cdca713b3cd52cd85ed5dc8923a5d97ec0a38a4
Parents: 5f553f3
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 13:36:58 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 21 13:37:39 2013 -0400
----------------------------------------------------------------------
Gruntfile.js | 28 +++++++++++++++++++++++++++-
Jakefile | 48 ------------------------------------------------
2 files changed, 27 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2cdca713/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 7665623..3b9ca4e 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,6 +17,7 @@
* under the License.
*/
module.exports = function(grunt) {
+ var childProcess = require('child_process');
var fs = require('fs');
var path = require('path');
@@ -152,9 +153,34 @@ module.exports = function(grunt) {
}, done);
});
+ // TODO - Delete this task and use Grunt's built-in jshint (CB-3964).
+ grunt.registerTask('hint', 'Runs jshint.', function() {
+ var done = this.async();
+ var knownWarnings = [
+ "Redefinition of 'FileReader'",
+ "Redefinition of 'require'",
+ "Read only",
+ "Redefinition of 'console'"
+ ];
+ var filterKnownWarnings = function(el, index, array) {
+ var wut = true;
+ // filter out the known warnings listed out above
+ knownWarnings.forEach(function(e) {
+ wut = wut && (el.indexOf(e) == -1);
+ });
+ wut = wut && (!el.match(/\d+ errors/));
+ return wut;
+ };
+
+ childProcess.exec("jshint lib", function(err,stdout,stderr) {
+ var exs = stdout.split('\n');
+ grunt.log.writeln(exs.filter(filterKnownWarnings).join('\n'));
+ done();
+ });
+ });
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task(s).
- grunt.registerTask('default', ['cordovajs', 'complainwhitespace', 'test']);
+ grunt.registerTask('default', ['cordovajs', 'hint', 'complainwhitespace', 'test']);
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2cdca713/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
deleted file mode 100644
index 089b9b0..0000000
--- a/Jakefile
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements. See th
- * distributed with this work for additional infor
- * regarding copyright ownership. The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License. You may obtain a copy of the
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied. See the Licen
- * specific language governing permissions and lim
- * under the License.
- */
-
-var childProcess = require('child_process');
-
-task('default', ['hint'], function () {});
-
-desc('check sources with JSHint');
-task('hint', [], function () {
- var knownWarnings = [
- "Redefinition of 'FileReader'",
- "Redefinition of 'require'",
- "Read only",
- "Redefinition of 'console'"
- ];
- var filterKnownWarnings = function(el, index, array) {
- var wut = true;
- // filter out the known warnings listed out above
- knownWarnings.forEach(function(e) {
- wut = wut && (el.indexOf(e) == -1);
- });
- wut = wut && (!el.match(/\d+ errors/));
- return wut;
- };
-
- childProcess.exec("jshint lib",function(err,stdout,stderr) {
- var exs = stdout.split('\n');
- console.log(exs.filter(filterKnownWarnings).join('\n'));
- complete();
- });
-}, true);
-