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:
- 1
- "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() {
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);

View File

@ -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 = '<test-bind-scope item-list="fakeData">{$ item.animal $}</test-bind-scope>';

View File

@ -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'
}
);
}

View File

@ -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'));

View File

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

View File

@ -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.";

View File

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

View File

@ -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];
}
}
}());

View File

@ -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'
}
);
}

View File

@ -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'
}
);
}

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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'));

View File

@ -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', {}];

View File

@ -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

View File

@ -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', []);

View File

@ -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",