From d7ef2b34bf0cdb8d040cabf5cb838eb56ff70a28 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Mon, 17 Aug 2015 11:43:33 -0700 Subject: [PATCH] Upgraded eslint rule libraries. The newer version of eslint comes with somewhat stricter rules about indentation and whitespace, so some files have been adjusted to accomodate. The newer version of eslint-config-openstack includes a relaxed version requirement for eslint, as well as a switch/case indentation update. The newer version of the angular eslint rules includes a deprecation rule for $cookieStorage, which has been set to warning. Change-Id: Id201a42e3ab484222f938a541507df2e96da2dcf Partially-Implements: blueprint jscs-cleanup --- .eslintrc | 4 ++ horizon/static/auth/login/login.spec.js | 10 ++-- .../util/bind-scope/bind-scope.spec.js | 6 +-- .../hz-promise-toggle.directive.mock.js | 10 ++-- .../widgets/charts/pie-chart.spec.js | 2 +- .../help-panel/help-panel.directive.spec.js | 4 +- .../framework/widgets/toast/toast.spec.js | 10 ++-- .../framework/widgets/wizard/wizard.spec.js | 4 +- openstack_dashboard/static/app/app.module.js | 49 +++++++++---------- .../hz-if-nova-extensions.directive.js | 10 ++-- .../hz-if-settings.directive.js | 10 ++-- .../cinder.service.spec.js | 6 +-- .../glance.service.spec.js | 6 +-- .../heat.service.spec.js | 6 +-- .../keystone.service.spec.js | 6 +-- .../neutron.service.spec.js | 6 +-- .../nova.service.spec.js | 6 +-- .../policy.service.spec.js | 6 +-- .../security-group.service.spec.js | 6 +-- .../settings.service.spec.js | 12 ++--- .../app/core/workflow/decorator.service.js | 5 -- .../app/core/workflow/workflow.module.js | 5 -- package.json | 6 +-- 23 files changed, 94 insertions(+), 101 deletions(-) diff --git a/.eslintrc b/.eslintrc index 7f732dc088..14b4feea30 100644 --- a/.eslintrc +++ b/.eslintrc @@ -30,3 +30,7 @@ rules: angular/ng_controller_as_vm: - 1 - "ctrl" + + # Remove after migrating to angular 1.4 or later. + angular/ng_no_cookiestore: + - 1 \ No newline at end of file diff --git a/horizon/static/auth/login/login.spec.js b/horizon/static/auth/login/login.spec.js index 4000b23ce0..4311e5ad50 100644 --- a/horizon/static/auth/login/login.spec.js +++ b/horizon/static/auth/login/login.spec.js @@ -56,8 +56,8 @@ describe('when websso is not enabled', function() { var element, - helpText, authType, - userInput, passwordInput; + helpText, authType, + userInput, passwordInput; beforeEach(function() { element = $compile(regularMarkup)($rootScope); @@ -85,9 +85,9 @@ describe('when websso is enabled', function() { var element, - helpText, authType, - userInput, passwordInput, - domainInput, regionInput; + helpText, authType, + userInput, passwordInput, + domainInput, regionInput; beforeEach(function() { element = $compile(webssoMarkup)($rootScope); diff --git a/horizon/static/framework/util/bind-scope/bind-scope.spec.js b/horizon/static/framework/util/bind-scope/bind-scope.spec.js index 7476b70364..db80307c68 100644 --- a/horizon/static/framework/util/bind-scope/bind-scope.spec.js +++ b/horizon/static/framework/util/bind-scope/bind-scope.spec.js @@ -39,9 +39,9 @@ $scope = $injector.get('$rootScope').$new(); $scope.fakeData = [ - { id: '1', animal: 'cat' }, - { id: '2', animal: 'dog' }, - { id: '3', animal: 'fish' } + { id: '1', animal: 'cat' }, + { id: '2', animal: 'dog' }, + { id: '3', animal: 'fish' } ]; var markup = '{$ item.animal $}'; diff --git a/horizon/static/framework/util/promise-toggle/hz-promise-toggle.directive.mock.js b/horizon/static/framework/util/promise-toggle/hz-promise-toggle.directive.mock.js index 6ee8b1e167..ae4c4d50c0 100644 --- a/horizon/static/framework/util/promise-toggle/hz-promise-toggle.directive.mock.js +++ b/horizon/static/framework/util/promise-toggle/hz-promise-toggle.directive.mock.js @@ -51,11 +51,11 @@ */ function hzPromiseToggleMock(hzPromiseToggleTemplateDirective, mockService) { return angular.extend( - hzPromiseToggleTemplateDirective[0], - { - singlePromiseResolver: mockService.mockResolver, - name: 'hzPromiseToggleMock' - } + hzPromiseToggleTemplateDirective[0], + { + singlePromiseResolver: mockService.mockResolver, + name: 'hzPromiseToggleMock' + } ); } diff --git a/horizon/static/framework/widgets/charts/pie-chart.spec.js b/horizon/static/framework/widgets/charts/pie-chart.spec.js index 35933ed104..0521b919f0 100644 --- a/horizon/static/framework/widgets/charts/pie-chart.spec.js +++ b/horizon/static/framework/widgets/charts/pie-chart.spec.js @@ -26,7 +26,7 @@ describe('pie chart directive', function () { var $scope, $elementMax, $elementTotal, $elementOverMax, - $elementNoQuota, donutChartSettings, quotaChartDefaults; + $elementNoQuota, donutChartSettings, quotaChartDefaults; beforeEach(module('templates')); beforeEach(module('horizon.framework')); diff --git a/horizon/static/framework/widgets/help-panel/help-panel.directive.spec.js b/horizon/static/framework/widgets/help-panel/help-panel.directive.spec.js index 53a1c0a0f0..1f925ffea8 100644 --- a/horizon/static/framework/widgets/help-panel/help-panel.directive.spec.js +++ b/horizon/static/framework/widgets/help-panel/help-panel.directive.spec.js @@ -17,8 +17,8 @@ describe('help-panel directive', function () { var $compile, - $scope, - element; + $scope, + element; beforeEach(module('templates')); beforeEach(module('horizon.framework.widgets')); diff --git a/horizon/static/framework/widgets/toast/toast.spec.js b/horizon/static/framework/widgets/toast/toast.spec.js index 2a1984bdbd..18decd59fc 100644 --- a/horizon/static/framework/widgets/toast/toast.spec.js +++ b/horizon/static/framework/widgets/toast/toast.spec.js @@ -25,8 +25,8 @@ describe('toast factory', function() { var $compile, - $scope, - service; + $scope, + service; var successMsg = "I am success."; var dangerMsg = "I am danger."; @@ -94,9 +94,9 @@ describe('toast directive', function () { var $compile, - $scope, - $element, - service; + $scope, + $element, + service; var successMsg = "I am success."; var dangerMsg = "I am danger."; diff --git a/horizon/static/framework/widgets/wizard/wizard.spec.js b/horizon/static/framework/widgets/wizard/wizard.spec.js index 1a95abd09b..694e4727a4 100644 --- a/horizon/static/framework/widgets/wizard/wizard.spec.js +++ b/horizon/static/framework/widgets/wizard/wizard.spec.js @@ -24,8 +24,8 @@ describe('wizard directive', function () { var $compile, - $scope, - element; + $scope, + element; beforeEach(module('templates')); beforeEach(module('horizon.framework.widgets')); diff --git a/openstack_dashboard/static/app/app.module.js b/openstack_dashboard/static/app/app.module.js index 4d31bd7379..8066356f2c 100644 --- a/openstack_dashboard/static/app/app.module.js +++ b/openstack_dashboard/static/app/app.module.js @@ -80,35 +80,34 @@ $http, $cookies) { - $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; + $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; - // expose the legacy utils module - horizon.utils = hzUtils; + // expose the legacy utils module + horizon.utils = hzUtils; - horizon.conf.spinner_options = spinnerOptions; + horizon.conf.spinner_options = spinnerOptions; - horizon.cookies = angular.extend({}, $cookieStore, { - put: put, - getRaw: getRaw - }); - - // rewire the angular-gettext catalog to use django catalog - gettextCatalog.setCurrentLanguage(horizon.languageCode); - gettextCatalog.setStrings(horizon.languageCode, django.catalog); - - /* - * cookies are updated at the end of current $eval, so for the horizon - * namespace we need to wrap it in a $apply function. - */ - function put(key, value) { - angular.element('body').scope().$apply(function () { - $cookieStore.put(key, value); + horizon.cookies = angular.extend({}, $cookieStore, { + put: put, + getRaw: getRaw }); - } - function getRaw(key) { - return $cookies[key]; - } - } + // rewire the angular-gettext catalog to use django catalog + gettextCatalog.setCurrentLanguage(horizon.languageCode); + gettextCatalog.setStrings(horizon.languageCode, django.catalog); + /* + * cookies are updated at the end of current $eval, so for the horizon + * namespace we need to wrap it in a $apply function. + */ + function put(key, value) { + angular.element('body').scope().$apply(function () { + $cookieStore.put(key, value); + }); + } + + function getRaw(key) { + return $cookies[key]; + } + } }()); diff --git a/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js b/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js index 723c49f100..88dd0d7844 100644 --- a/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js +++ b/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js @@ -65,11 +65,11 @@ */ function hzNovaExtensions(hzPromiseToggleTemplateDirective, novaExtensions) { return angular.extend( - hzPromiseToggleTemplateDirective[0], - { - singlePromiseResolver: novaExtensions.ifNameEnabled, - name: 'hzIfNovaExtensions' - } + hzPromiseToggleTemplateDirective[0], + { + singlePromiseResolver: novaExtensions.ifNameEnabled, + name: 'hzIfNovaExtensions' + } ); } diff --git a/openstack_dashboard/static/app/core/cloud-services/hz-if-settings.directive.js b/openstack_dashboard/static/app/core/cloud-services/hz-if-settings.directive.js index e447268c78..e0fad0944e 100644 --- a/openstack_dashboard/static/app/core/cloud-services/hz-if-settings.directive.js +++ b/openstack_dashboard/static/app/core/cloud-services/hz-if-settings.directive.js @@ -94,11 +94,11 @@ */ function hzSettingsToggle(hzPromiseToggleTemplate, settingsService) { return angular.extend( - hzPromiseToggleTemplate[0], - { - singlePromiseResolver: settingsService.ifEnabled, - name: 'hzIfSettings' - } + hzPromiseToggleTemplate[0], + { + singlePromiseResolver: settingsService.ifEnabled, + name: 'hzIfSettings' + } ); } diff --git a/openstack_dashboard/static/app/core/openstack-service-api/cinder.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/cinder.service.spec.js index ed01e03681..529ebfe66f 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/cinder.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/cinder.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/glance.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/glance.service.spec.js index f061862bc5..355b4046b2 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/glance.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/glance.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/heat.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/heat.service.spec.js index 782dbe6e0d..ddd3450442 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/heat.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/heat.service.spec.js @@ -22,9 +22,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/keystone.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/keystone.service.spec.js index 0a09b5f8a9..d0ee794a82 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/keystone.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/keystone.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js index 6ef01daad3..81621e23aa 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js index 858fb44353..bab3d46b2b 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/policy.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/policy.service.spec.js index bb05b10144..3f51965feb 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/policy.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/policy.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/security-group.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/security-group.service.spec.js index 362e4f28aa..c7637988e2 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/security-group.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/security-group.service.spec.js @@ -24,9 +24,9 @@ beforeEach( module('horizon.mock.openstack-service-api', - function($provide, initServices) { - testCall = initServices($provide, apiService, toastService); - }) + function($provide, initServices) { + testCall = initServices($provide, apiService, toastService); + }) ); beforeEach(module('horizon.app.core.openstack-service-api')); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/settings.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/settings.service.spec.js index f00ab50696..72eed67962 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/settings.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/settings.service.spec.js @@ -21,12 +21,12 @@ var $httpBackend; var responseMockOpts = {succeed: true}; var testData = { - isTrue: true, - isFalse: false, - versions: {one: 1, two: 2}, - deep: {nest: {foo: 'bar'}}, - isNull: null - }; + isTrue: true, + isFalse: false, + versions: {one: 1, two: 2}, + deep: {nest: {foo: 'bar'}}, + isNull: null + }; function responseMockReturn() { return responseMockOpts.succeed ? [200, testData, {}] : [500, 'Fail', {}]; diff --git a/openstack_dashboard/static/app/core/workflow/decorator.service.js b/openstack_dashboard/static/app/core/workflow/decorator.service.js index 2db07be99d..872ccd09a2 100644 --- a/openstack_dashboard/static/app/core/workflow/decorator.service.js +++ b/openstack_dashboard/static/app/core/workflow/decorator.service.js @@ -38,11 +38,6 @@ * @param {Object} spec The input workflow specification object. * @returns {Object} The decorated workflow specification object, the same * reference to the input spec object. - * - * | Factories | - * |----------------------------------------------------------------------------------------------------------| - * | {@link horizon.app.core.workflow.factory:horizon.app.core.workflow.decorator `horizon.app.core.workflow.decorator`} | - * */ /* eslint-ensable max-len */ angular diff --git a/openstack_dashboard/static/app/core/workflow/workflow.module.js b/openstack_dashboard/static/app/core/workflow/workflow.module.js index d5ed9bc68f..cd9dbd7199 100644 --- a/openstack_dashboard/static/app/core/workflow/workflow.module.js +++ b/openstack_dashboard/static/app/core/workflow/workflow.module.js @@ -26,11 +26,6 @@ * * This module provides utility function factory `dashboardWorkflow` and * `dashboardWorkflowDecorator`. - * - * | Factories | - * |------------------------------------------------------------------------------------------------| - * | {@link horizon.app.core.workflow.factory:dashboardWorkflowDecorator `dashboardWorkflowDecorator`} | - * */ /* eslint-enable max-len */ angular.module('horizon.app.core.workflow', []); diff --git a/package.json b/package.json index 68762ca929..62c3aa1aa1 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,9 @@ "repository": "none", "license": "Apache 2.0", "devDependencies": { - "eslint": "^0.23.0", - "eslint-config-openstack": "1.2.0", - "eslint-plugin-angular": "0.0.10", + "eslint": "1.2.0", + "eslint-config-openstack": "1.2.2", + "eslint-plugin-angular": "0.4.0", "jasmine-core": "2.2.0", "karma": "0.12.31", "karma-chrome-launcher": "0.1.8",