Apply Jshint to files

This commit is contained in:
Vincent Fournier 2015-05-04 10:13:18 -04:00
parent 5f4f119e6c
commit e9932e47c2
7 changed files with 37 additions and 25 deletions

View File

@ -78,10 +78,19 @@ module.exports = function (grunt) {
jshint: { // configure the task jshint: { // configure the task
options: { options: {
node: true,
loopfunc: true,
globals: { globals: {
document: true,
angular: true, angular: true,
jQuery: true jQuery: true,
}, $: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
inject: true
},
force: true force: true
}, },
all: [ all: [
@ -89,7 +98,9 @@ module.exports = function (grunt) {
'Gruntfile.js', 'Gruntfile.js',
'<%= project.app %>/app.js', '<%= project.app %>/app.js',
'<%= project.app %>/**/*.js', '<%= project.app %>/**/*.js',
'!<%= project.app %>/bower_components/**' '!<%= project.app %>/bower_components/**',
'!<%= project.app %>/**/live.js',
'!<%= project.app %>/**/adagios.js'
] ]
}, },
@ -130,7 +141,7 @@ module.exports = function (grunt) {
'<%= project.app %>/components/live/adagios.js', '<%= project.app %>/components/live/adagios.js',
'<%= project.assets %>/sass/{,*/}*.{scss,sass}' '<%= project.assets %>/sass/{,*/}*.{scss,sass}'
], ],
tasks: ['copy:adagios', 'sass:dev'] tasks: ['copy:adagios', 'sass:dev', 'jshint:all']
}, },
surveil: { surveil: {
files: [ files: [
@ -139,7 +150,7 @@ module.exports = function (grunt) {
'<%= project.app %>/components/live/surveil.js', '<%= project.app %>/components/live/surveil.js',
'<%= project.assets %>/sass/{,*/}*.{scss,sass}' '<%= project.assets %>/sass/{,*/}*.{scss,sass}'
], ],
tasks: ['copy:surveil', 'sass:dev'] tasks: ['copy:surveil', 'sass:dev', 'jshint:all']
}, },
options: { options: {
livereload: true livereload: true

View File

@ -1,3 +1,4 @@
/*global moment */
'use strict'; 'use strict';
angular.module('bansho.filters', []) angular.module('bansho.filters', [])

View File

@ -25,7 +25,7 @@ angular.module('bansho.live', [])
defaults = angular.isArray(defaults) ? defaults : [defaults]; defaults = angular.isArray(defaults) ? defaults : [defaults];
return defaults.concat(transform); return defaults.concat(transform);
}; }
if (apiName === 'hosts') { if (apiName === 'hosts') {
transformations = hostMiddleware; transformations = hostMiddleware;
@ -111,7 +111,7 @@ angular.module('bansho.live', [])
}); });
return responsePromise.promise; return responsePromise.promise;
} };
var getHostProblems = function () { var getHostProblems = function () {
var fields = ['state'], var fields = ['state'],
@ -136,7 +136,7 @@ angular.module('bansho.live', [])
.error(function () { .error(function () {
throw new Error('getServiceOpenProblems : POST Request failed'); throw new Error('getServiceOpenProblems : POST Request failed');
}); });
} };
// This service is used to count the number of hosts // This service is used to count the number of hosts
var getTotalHosts = function () { var getTotalHosts = function () {
@ -149,7 +149,7 @@ angular.module('bansho.live', [])
.error(function () { .error(function () {
throw new Error('getTotalHosts : POST Request failed'); throw new Error('getTotalHosts : POST Request failed');
}); });
} };
// This service is used to count the number of services // This service is used to count the number of services
var getTotalServices = function () { var getTotalServices = function () {
@ -162,7 +162,7 @@ angular.module('bansho.live', [])
.error(function () { .error(function () {
throw new Error('getTotalServices : POST Request failed'); throw new Error('getTotalServices : POST Request failed');
}); });
} };
var getHost = function (objectType, objectIdentifier) { var getHost = function (objectType, objectIdentifier) {
var objectData = {}, var objectData = {},
@ -179,11 +179,11 @@ angular.module('bansho.live', [])
objectData.live = liveData; objectData.live = liveData;
objectData.config = configData; objectData.config = configData;
responsePromise.resolve(objectData); responsePromise.resolve(objectData);
}) });
}); });
return responsePromise.promise; return responsePromise.promise;
} };
var hostQueryTransform = function (fields, filters) { var hostQueryTransform = function (fields, filters) {
var i, var i,
@ -196,7 +196,7 @@ angular.module('bansho.live', [])
fields[i] = transformations[fields[i]]; fields[i] = transformations[fields[i]];
} }
} }
} };
// Modify response object to conform to web ui // Modify response object to conform to web ui
var hostMiddleware = function (data) { var hostMiddleware = function (data) {
@ -215,7 +215,7 @@ angular.module('bansho.live', [])
} }
return data; return data;
} };
// Modify response object to conform to web ui // Modify response object to conform to web ui
var serviceMiddleware = function (data) { var serviceMiddleware = function (data) {
@ -285,7 +285,7 @@ angular.module('bansho.live', [])
} else { } else {
serviceAdditionnalFields[field] = value; serviceAdditionnalFields[field] = value;
} }
}) });
angular.forEach(filters, function (filterData, filterName) { angular.forEach(filters, function (filterData, filterName) {
angular.forEach(filterData, function (values, field) { angular.forEach(filterData, function (values, field) {
@ -335,7 +335,7 @@ angular.module('bansho.live', [])
}); });
return responsePromise.promise; return responsePromise.promise;
} };
var acknowledge = function (host_name, service_description, attrs) { var acknowledge = function (host_name, service_description, attrs) {
var data = {}; var data = {};

View File

@ -1,3 +1,4 @@
/*global JustGage */
'use strict'; 'use strict';
angular.module("ngJustGage", []) angular.module("ngJustGage", [])

View File

@ -36,13 +36,13 @@ angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live'])
$scope.isAcknowledgeShown = false; $scope.isAcknowledgeShown = false;
$scope.isDowntimeShown = !$scope.isDowntimeShown; $scope.isDowntimeShown = !$scope.isDowntimeShown;
} };
$scope.switchAcknowledgeForm = function () { $scope.switchAcknowledgeForm = function () {
$scope.isDowntimeShown = false; $scope.isDowntimeShown = false;
$scope.isAcknowledgeShown = !$scope.isAcknowledgeShown; $scope.isAcknowledgeShown = !$scope.isAcknowledgeShown;
} };
$scope.actionbarFilters = actionbarFilters; $scope.actionbarFilters = actionbarFilters;
$scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[0]; $scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[0];

View File

@ -19,7 +19,7 @@ angular.module('bansho.table.actionbar')
actionbarFilters.searchFilter); actionbarFilters.searchFilter);
angular.forEach(entries, function (entry) { angular.forEach(entries, function (entry) {
var service_description = undefined; var service_description;
if (entry.is_checked) { if (entry.is_checked) {
if ('description' in entry) { if ('description' in entry) {
@ -34,7 +34,7 @@ angular.module('bansho.table.actionbar')
}); });
}; };
} }
} };
}]) }])
.directive('banshoDowntimeForm', .directive('banshoDowntimeForm',
@ -55,7 +55,7 @@ angular.module('bansho.table.actionbar')
var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter); var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter);
angular.forEach(entries, function (entry) { angular.forEach(entries, function (entry) {
var service_description = undefined; var service_description;
if (entry.is_checked) { if (entry.is_checked) {
if ('description' in entry) { if ('description' in entry) {
@ -78,7 +78,7 @@ angular.module('bansho.table.actionbar')
} }
}); });
}); });
} };
} }
} };
}]); }]);

View File

@ -76,8 +76,7 @@ angular.module('bansho.table', ['bansho.live',
conf; conf;
if (!attrs.cellsText || !attrs.cellsName || !attrs.apiName || !attrs.isWrappable) { if (!attrs.cellsText || !attrs.cellsName || !attrs.apiName || !attrs.isWrappable) {
throw new Error('<bansho-table> "cells-text", "cells-name", "api-name"' throw new Error('<bansho-table> "cells-text", "cells-name", "api-name" and "is-wrappable" attributes must be defined');
+ ' and "is-wrappable" attributes must be defined');
} }
tablesConfig[attrs.tableId] = {}; tablesConfig[attrs.tableId] = {};