diff --git a/Gruntfile.js b/Gruntfile.js index a8d3c0b..a2a947d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -78,10 +78,19 @@ module.exports = function (grunt) { jshint: { // configure the task options: { + node: true, + loopfunc: true, globals: { + document: true, angular: true, - jQuery: true - }, + jQuery: true, + $: true, + describe: true, + it: true, + expect: true, + beforeEach: true, + inject: true + }, force: true }, all: [ @@ -89,7 +98,9 @@ module.exports = function (grunt) { 'Gruntfile.js', '<%= project.app %>/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.assets %>/sass/{,*/}*.{scss,sass}' ], - tasks: ['copy:adagios', 'sass:dev'] + tasks: ['copy:adagios', 'sass:dev', 'jshint:all'] }, surveil: { files: [ @@ -139,7 +150,7 @@ module.exports = function (grunt) { '<%= project.app %>/components/live/surveil.js', '<%= project.assets %>/sass/{,*/}*.{scss,sass}' ], - tasks: ['copy:surveil', 'sass:dev'] + tasks: ['copy:surveil', 'sass:dev', 'jshint:all'] }, options: { livereload: true diff --git a/app/components/filters/filters.js b/app/components/filters/filters.js index a021f46..583cc2f 100644 --- a/app/components/filters/filters.js +++ b/app/components/filters/filters.js @@ -1,3 +1,4 @@ +/*global moment */ 'use strict'; angular.module('bansho.filters', []) diff --git a/app/components/live/surveil.js b/app/components/live/surveil.js index d95d843..f111acb 100644 --- a/app/components/live/surveil.js +++ b/app/components/live/surveil.js @@ -25,7 +25,7 @@ angular.module('bansho.live', []) defaults = angular.isArray(defaults) ? defaults : [defaults]; return defaults.concat(transform); - }; + } if (apiName === 'hosts') { transformations = hostMiddleware; @@ -111,7 +111,7 @@ angular.module('bansho.live', []) }); return responsePromise.promise; - } + }; var getHostProblems = function () { var fields = ['state'], @@ -136,7 +136,7 @@ angular.module('bansho.live', []) .error(function () { throw new Error('getServiceOpenProblems : POST Request failed'); }); - } + }; // This service is used to count the number of hosts var getTotalHosts = function () { @@ -149,7 +149,7 @@ angular.module('bansho.live', []) .error(function () { throw new Error('getTotalHosts : POST Request failed'); }); - } + }; // This service is used to count the number of services var getTotalServices = function () { @@ -162,7 +162,7 @@ angular.module('bansho.live', []) .error(function () { throw new Error('getTotalServices : POST Request failed'); }); - } + }; var getHost = function (objectType, objectIdentifier) { var objectData = {}, @@ -179,11 +179,11 @@ angular.module('bansho.live', []) objectData.live = liveData; objectData.config = configData; responsePromise.resolve(objectData); - }) + }); }); return responsePromise.promise; - } + }; var hostQueryTransform = function (fields, filters) { var i, @@ -196,7 +196,7 @@ angular.module('bansho.live', []) fields[i] = transformations[fields[i]]; } } - } + }; // Modify response object to conform to web ui var hostMiddleware = function (data) { @@ -215,7 +215,7 @@ angular.module('bansho.live', []) } return data; - } + }; // Modify response object to conform to web ui var serviceMiddleware = function (data) { @@ -285,7 +285,7 @@ angular.module('bansho.live', []) } else { serviceAdditionnalFields[field] = value; } - }) + }); angular.forEach(filters, function (filterData, filterName) { angular.forEach(filterData, function (values, field) { @@ -335,7 +335,7 @@ angular.module('bansho.live', []) }); return responsePromise.promise; - } + }; var acknowledge = function (host_name, service_description, attrs) { var data = {}; diff --git a/app/components/ng-justgage/ng-justgage.js b/app/components/ng-justgage/ng-justgage.js index d0f1859..8e43a1f 100644 --- a/app/components/ng-justgage/ng-justgage.js +++ b/app/components/ng-justgage/ng-justgage.js @@ -1,3 +1,4 @@ +/*global JustGage */ 'use strict'; angular.module("ngJustGage", []) diff --git a/app/components/table/actionbar/actionbar.js b/app/components/table/actionbar/actionbar.js index 40a7266..2895a37 100644 --- a/app/components/table/actionbar/actionbar.js +++ b/app/components/table/actionbar/actionbar.js @@ -36,13 +36,13 @@ angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live']) $scope.isAcknowledgeShown = false; $scope.isDowntimeShown = !$scope.isDowntimeShown; - } + }; $scope.switchAcknowledgeForm = function () { $scope.isDowntimeShown = false; $scope.isAcknowledgeShown = !$scope.isAcknowledgeShown; - } + }; $scope.actionbarFilters = actionbarFilters; $scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[0]; diff --git a/app/components/table/actionbar/actions/actions.js b/app/components/table/actionbar/actions/actions.js index a677dbe..eeedae5 100644 --- a/app/components/table/actionbar/actions/actions.js +++ b/app/components/table/actionbar/actions/actions.js @@ -19,7 +19,7 @@ angular.module('bansho.table.actionbar') actionbarFilters.searchFilter); angular.forEach(entries, function (entry) { - var service_description = undefined; + var service_description; if (entry.is_checked) { if ('description' in entry) { @@ -34,7 +34,7 @@ angular.module('bansho.table.actionbar') }); }; } - } + }; }]) .directive('banshoDowntimeForm', @@ -55,7 +55,7 @@ angular.module('bansho.table.actionbar') var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter); angular.forEach(entries, function (entry) { - var service_description = undefined; + var service_description; if (entry.is_checked) { if ('description' in entry) { @@ -78,7 +78,7 @@ angular.module('bansho.table.actionbar') } }); }); - } + }; } - } + }; }]); diff --git a/app/components/table/table.js b/app/components/table/table.js index 420fc5a..078b593 100644 --- a/app/components/table/table.js +++ b/app/components/table/table.js @@ -76,8 +76,7 @@ angular.module('bansho.table', ['bansho.live', conf; if (!attrs.cellsText || !attrs.cellsName || !attrs.apiName || !attrs.isWrappable) { - throw new Error(' "cells-text", "cells-name", "api-name"' - + ' and "is-wrappable" attributes must be defined'); + throw new Error(' "cells-text", "cells-name", "api-name" and "is-wrappable" attributes must be defined'); } tablesConfig[attrs.tableId] = {};