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
This commit is contained in:
Michael Krotscheck 2015-08-17 11:43:33 -07:00
parent dbe10c5ea7
commit d7ef2b34bf
23 changed files with 94 additions and 101 deletions

View File

@ -30,3 +30,7 @@ rules:
angular/ng_controller_as_vm: angular/ng_controller_as_vm:
- 1 - 1
- "ctrl" - "ctrl"
# Remove after migrating to angular 1.4 or later.
angular/ng_no_cookiestore:
- 1

View File

@ -56,8 +56,8 @@
describe('when websso is not enabled', function() { describe('when websso is not enabled', function() {
var element, var element,
helpText, authType, helpText, authType,
userInput, passwordInput; userInput, passwordInput;
beforeEach(function() { beforeEach(function() {
element = $compile(regularMarkup)($rootScope); element = $compile(regularMarkup)($rootScope);
@ -85,9 +85,9 @@
describe('when websso is enabled', function() { describe('when websso is enabled', function() {
var element, var element,
helpText, authType, helpText, authType,
userInput, passwordInput, userInput, passwordInput,
domainInput, regionInput; domainInput, regionInput;
beforeEach(function() { beforeEach(function() {
element = $compile(webssoMarkup)($rootScope); element = $compile(webssoMarkup)($rootScope);

View File

@ -39,9 +39,9 @@
$scope = $injector.get('$rootScope').$new(); $scope = $injector.get('$rootScope').$new();
$scope.fakeData = [ $scope.fakeData = [
{ id: '1', animal: 'cat' }, { id: '1', animal: 'cat' },
{ id: '2', animal: 'dog' }, { id: '2', animal: 'dog' },
{ id: '3', animal: 'fish' } { id: '3', animal: 'fish' }
]; ];
var markup = '<test-bind-scope item-list="fakeData">{$ item.animal $}</test-bind-scope>'; var markup = '<test-bind-scope item-list="fakeData">{$ item.animal $}</test-bind-scope>';

View File

@ -51,11 +51,11 @@
*/ */
function hzPromiseToggleMock(hzPromiseToggleTemplateDirective, mockService) { function hzPromiseToggleMock(hzPromiseToggleTemplateDirective, mockService) {
return angular.extend( return angular.extend(
hzPromiseToggleTemplateDirective[0], hzPromiseToggleTemplateDirective[0],
{ {
singlePromiseResolver: mockService.mockResolver, singlePromiseResolver: mockService.mockResolver,
name: 'hzPromiseToggleMock' name: 'hzPromiseToggleMock'
} }
); );
} }

View File

@ -26,7 +26,7 @@
describe('pie chart directive', function () { describe('pie chart directive', function () {
var $scope, $elementMax, $elementTotal, $elementOverMax, var $scope, $elementMax, $elementTotal, $elementOverMax,
$elementNoQuota, donutChartSettings, quotaChartDefaults; $elementNoQuota, donutChartSettings, quotaChartDefaults;
beforeEach(module('templates')); beforeEach(module('templates'));
beforeEach(module('horizon.framework')); beforeEach(module('horizon.framework'));

View File

@ -17,8 +17,8 @@
describe('help-panel directive', function () { describe('help-panel directive', function () {
var $compile, var $compile,
$scope, $scope,
element; element;
beforeEach(module('templates')); beforeEach(module('templates'));
beforeEach(module('horizon.framework.widgets')); beforeEach(module('horizon.framework.widgets'));

View File

@ -25,8 +25,8 @@
describe('toast factory', function() { describe('toast factory', function() {
var $compile, var $compile,
$scope, $scope,
service; service;
var successMsg = "I am success."; var successMsg = "I am success.";
var dangerMsg = "I am danger."; var dangerMsg = "I am danger.";
@ -94,9 +94,9 @@
describe('toast directive', function () { describe('toast directive', function () {
var $compile, var $compile,
$scope, $scope,
$element, $element,
service; service;
var successMsg = "I am success."; var successMsg = "I am success.";
var dangerMsg = "I am danger."; var dangerMsg = "I am danger.";

View File

@ -24,8 +24,8 @@
describe('wizard directive', function () { describe('wizard directive', function () {
var $compile, var $compile,
$scope, $scope,
element; element;
beforeEach(module('templates')); beforeEach(module('templates'));
beforeEach(module('horizon.framework.widgets')); beforeEach(module('horizon.framework.widgets'));

View File

@ -80,35 +80,34 @@
$http, $http,
$cookies) { $cookies) {
$http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
// expose the legacy utils module // expose the legacy utils module
horizon.utils = hzUtils; horizon.utils = hzUtils;
horizon.conf.spinner_options = spinnerOptions; horizon.conf.spinner_options = spinnerOptions;
horizon.cookies = angular.extend({}, $cookieStore, { horizon.cookies = angular.extend({}, $cookieStore, {
put: put, put: put,
getRaw: getRaw 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);
}); });
}
function getRaw(key) { // rewire the angular-gettext catalog to use django catalog
return $cookies[key]; 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];
}
}
}()); }());

View File

@ -65,11 +65,11 @@
*/ */
function hzNovaExtensions(hzPromiseToggleTemplateDirective, novaExtensions) { function hzNovaExtensions(hzPromiseToggleTemplateDirective, novaExtensions) {
return angular.extend( return angular.extend(
hzPromiseToggleTemplateDirective[0], hzPromiseToggleTemplateDirective[0],
{ {
singlePromiseResolver: novaExtensions.ifNameEnabled, singlePromiseResolver: novaExtensions.ifNameEnabled,
name: 'hzIfNovaExtensions' name: 'hzIfNovaExtensions'
} }
); );
} }

View File

@ -94,11 +94,11 @@
*/ */
function hzSettingsToggle(hzPromiseToggleTemplate, settingsService) { function hzSettingsToggle(hzPromiseToggleTemplate, settingsService) {
return angular.extend( return angular.extend(
hzPromiseToggleTemplate[0], hzPromiseToggleTemplate[0],
{ {
singlePromiseResolver: settingsService.ifEnabled, singlePromiseResolver: settingsService.ifEnabled,
name: 'hzIfSettings' name: 'hzIfSettings'
} }
); );
} }

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -22,9 +22,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -24,9 +24,9 @@
beforeEach( beforeEach(
module('horizon.mock.openstack-service-api', module('horizon.mock.openstack-service-api',
function($provide, initServices) { function($provide, initServices) {
testCall = initServices($provide, apiService, toastService); testCall = initServices($provide, apiService, toastService);
}) })
); );
beforeEach(module('horizon.app.core.openstack-service-api')); beforeEach(module('horizon.app.core.openstack-service-api'));

View File

@ -21,12 +21,12 @@
var $httpBackend; var $httpBackend;
var responseMockOpts = {succeed: true}; var responseMockOpts = {succeed: true};
var testData = { var testData = {
isTrue: true, isTrue: true,
isFalse: false, isFalse: false,
versions: {one: 1, two: 2}, versions: {one: 1, two: 2},
deep: {nest: {foo: 'bar'}}, deep: {nest: {foo: 'bar'}},
isNull: null isNull: null
}; };
function responseMockReturn() { function responseMockReturn() {
return responseMockOpts.succeed ? [200, testData, {}] : [500, 'Fail', {}]; return responseMockOpts.succeed ? [200, testData, {}] : [500, 'Fail', {}];

View File

@ -38,11 +38,6 @@
* @param {Object} spec The input workflow specification object. * @param {Object} spec The input workflow specification object.
* @returns {Object} The decorated workflow specification object, the same * @returns {Object} The decorated workflow specification object, the same
* reference to the input spec object. * 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 */ /* eslint-ensable max-len */
angular angular

View File

@ -26,11 +26,6 @@
* *
* This module provides utility function factory `dashboardWorkflow` and * This module provides utility function factory `dashboardWorkflow` and
* `dashboardWorkflowDecorator`. * `dashboardWorkflowDecorator`.
*
* | Factories |
* |------------------------------------------------------------------------------------------------|
* | {@link horizon.app.core.workflow.factory:dashboardWorkflowDecorator `dashboardWorkflowDecorator`} |
*
*/ */
/* eslint-enable max-len */ /* eslint-enable max-len */
angular.module('horizon.app.core.workflow', []); angular.module('horizon.app.core.workflow', []);

View File

@ -6,9 +6,9 @@
"repository": "none", "repository": "none",
"license": "Apache 2.0", "license": "Apache 2.0",
"devDependencies": { "devDependencies": {
"eslint": "^0.23.0", "eslint": "1.2.0",
"eslint-config-openstack": "1.2.0", "eslint-config-openstack": "1.2.2",
"eslint-plugin-angular": "0.0.10", "eslint-plugin-angular": "0.4.0",
"jasmine-core": "2.2.0", "jasmine-core": "2.2.0",
"karma": "0.12.31", "karma": "0.12.31",
"karma-chrome-launcher": "0.1.8", "karma-chrome-launcher": "0.1.8",