Reduce lint warnings
Reduce some of the most obvious lint warnings like braces. Change-Id: Ib4740ed0cf358374600a99c69559fec52215727c
This commit is contained in:
parent
dea5b2878e
commit
cfbfab4142
@ -40,7 +40,7 @@
|
||||
toBeVisible: function() {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
var pass = (actual.css('display') !== 'none');
|
||||
var pass = actual.css('display') !== 'none';
|
||||
var result = {
|
||||
pass: pass,
|
||||
message: pass ?
|
||||
|
@ -233,7 +233,7 @@
|
||||
return items.filter(function filterItems(item) {
|
||||
return item._ext && item._ext.position === position;
|
||||
}).sort(function sortItems(a, b) {
|
||||
return (a._ext.priority - b._ext.priority) || 1;
|
||||
return a._ext.priority - b._ext.priority || 1;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
yesNoFilter.$inject = ['horizon.framework.util.i18n.gettext'];
|
||||
function yesNoFilter(gettext) {
|
||||
return function (input) {
|
||||
return (input ? gettext("Yes") : gettext("No"));
|
||||
return input ? gettext("Yes") : gettext("No");
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,9 @@
|
||||
*/
|
||||
function getText($window) {
|
||||
// If no global function, revert to just returning given text.
|
||||
var gettextFunc = $window.gettext || function (x) { return x; };
|
||||
var gettextFunc = $window.gettext || function (x) {
|
||||
return x;
|
||||
};
|
||||
|
||||
// Eventually, could delete the window gettext references here,
|
||||
// or provide an appropriate method.
|
||||
|
@ -38,7 +38,9 @@
|
||||
|
||||
describe("injected window.gettext", function () {
|
||||
beforeEach(module(function ($provide) {
|
||||
var $window = { gettext: function (x) { return x.replace(/good/, 'bad'); } };
|
||||
var $window = { gettext: function (x) {
|
||||
return x.replace(/good/, 'bad');
|
||||
}};
|
||||
$provide.value('$window', $window);
|
||||
}));
|
||||
|
||||
|
@ -150,7 +150,9 @@
|
||||
|
||||
var pie = d3.layout.pie()
|
||||
.sort(null)
|
||||
.value(function (d) { return d.value; });
|
||||
.value(function (d) {
|
||||
return d.value;
|
||||
});
|
||||
}
|
||||
|
||||
var unwatch = scope.$watch('chartData', updateChart);
|
||||
@ -174,7 +176,9 @@
|
||||
scope.model.total = scope.chartData.maxLimit;
|
||||
scope.model.totalLabel = gettext('Max');
|
||||
} else {
|
||||
scope.model.total = d3.sum(scope.chartData.data, function (d) { return d.value; });
|
||||
scope.model.total = d3.sum(scope.chartData.data, function (d) {
|
||||
return d.value;
|
||||
});
|
||||
scope.model.totalLabel = gettext('Total');
|
||||
}
|
||||
scope.model.tooltipData.enabled = false;
|
||||
@ -199,7 +203,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
chart.on('mouseenter', function (d) { showTooltip(d, this); })
|
||||
chart.on('mouseenter', function (d) {
|
||||
showTooltip(d, this);
|
||||
})
|
||||
.on('mouseleave', clearTooltip);
|
||||
|
||||
// Animate the slice rendering
|
||||
|
@ -62,8 +62,7 @@
|
||||
if (item.parent) {
|
||||
item.parent.addedCount -= 1;
|
||||
}
|
||||
}
|
||||
else if (!item.custom) {
|
||||
} else if (!item.custom) {
|
||||
ctrl.hide = false;
|
||||
}
|
||||
}
|
||||
|
@ -102,14 +102,16 @@
|
||||
it("returns required", function() {
|
||||
var error = {required: true};
|
||||
ctrl.text = {required: "texreq"};
|
||||
|
||||
/*eslint-disable no-undefined */
|
||||
expect(ctrl.formatErrorMessage(undefined, error)).toBe('texreq');
|
||||
/*eslint-enable no-undefined */
|
||||
});
|
||||
|
||||
it("returns nothing when nothing for error", function() {
|
||||
var error = {};
|
||||
|
||||
/*eslint-disable no-undefined */
|
||||
expect(ctrl.formatErrorMessage(undefined, error)).toBeUndefined();
|
||||
/*eslint-enable no-undefined */
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -205,7 +205,7 @@
|
||||
$scope = $injector.get('$rootScope').$new();
|
||||
|
||||
var serviceName = 'horizon.framework.widgets.metadata.tree.service';
|
||||
item = new ($injector.get(serviceName).Item)();
|
||||
item = new ($injector.get(serviceName)).Item();
|
||||
$scope.item = item.fromProperty('test', namespaces[0].properties['test:A:6']);
|
||||
|
||||
var markup = '<metadata-tree-item' +
|
||||
|
@ -44,8 +44,12 @@
|
||||
function SimpleModalController($modalInstance, context) {
|
||||
var ctrl = this;
|
||||
ctrl.context = context;
|
||||
ctrl.submit = function() { $modalInstance.close(); };
|
||||
ctrl.cancel = function() { $modalInstance.dismiss('cancel'); };
|
||||
ctrl.submit = function() {
|
||||
$modalInstance.close();
|
||||
};
|
||||
ctrl.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
} // end of function
|
||||
|
||||
})();
|
||||
|
@ -70,7 +70,9 @@
|
||||
var service, modal;
|
||||
|
||||
beforeEach(module(function($provide) {
|
||||
modal = { open: function() {return 'val'; } };
|
||||
modal = { open: function() {
|
||||
return 'val';
|
||||
}};
|
||||
$provide.value('$modal', modal);
|
||||
}));
|
||||
|
||||
|
@ -125,9 +125,8 @@
|
||||
ctrl.limits.maxAllocation > ctrl.allocated.sourceItems.length) {
|
||||
ctrl.allocated.sourceItems.push(item);
|
||||
ctrl.allocatedIds[item.id] = true;
|
||||
}
|
||||
// Swap out items if only one allocation allowed
|
||||
else if (ctrl.limits.maxAllocation === 1) {
|
||||
} else if (ctrl.limits.maxAllocation === 1) {
|
||||
var temp = ctrl.allocated.sourceItems.pop();
|
||||
delete ctrl.allocatedIds[temp.id];
|
||||
// When swapping out, Smart-Table $watch is
|
||||
|
@ -27,7 +27,9 @@
|
||||
beforeEach(module(function($provide) {
|
||||
// we will mock scope and timeout in this test
|
||||
// because we aren't concern with rendering results
|
||||
var timeout = function(fn) { fn(); };
|
||||
var timeout = function(fn) {
|
||||
fn();
|
||||
};
|
||||
|
||||
// we will mock parse and attrs
|
||||
// because we want to control the parameters
|
||||
|
@ -48,7 +48,7 @@
|
||||
transferTable.$inject = [ 'horizon.framework.widgets.basePath' ];
|
||||
|
||||
function transferTable(path) {
|
||||
var directive = {
|
||||
return {
|
||||
controller: 'transferTableController',
|
||||
controllerAs: 'trCtrl',
|
||||
restrict: ' E',
|
||||
@ -58,8 +58,6 @@
|
||||
link: link
|
||||
};
|
||||
|
||||
return directive;
|
||||
|
||||
//////////////////////
|
||||
|
||||
function link(scope, element, attrs, ctrl, transclude) {
|
||||
@ -80,8 +78,7 @@
|
||||
transclude(availableScope, function(clone) {
|
||||
available.append(clone.filter('table'));
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
transclude(scope, function(clone) {
|
||||
allocated.append(clone.filter('allocated'));
|
||||
available.append(clone.filter('available'));
|
||||
|
@ -191,7 +191,11 @@
|
||||
});
|
||||
|
||||
it("checks steps' readiness", function() {
|
||||
var checkedStep = {checkReadiness: function() { return true; }};
|
||||
var checkedStep = {
|
||||
checkReadiness: function() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
$scope.workflow = {
|
||||
steps: [{}, checkedStep, {}]
|
||||
};
|
||||
|
@ -32,7 +32,7 @@
|
||||
});
|
||||
|
||||
it('returns No when object is undefined or has no properties', function() {
|
||||
expect(hasExtras(undefined)).not.toBeTruthy();
|
||||
expect(hasExtras()).not.toBeTruthy();
|
||||
expect(hasExtras({})).not.toBeTruthy();
|
||||
expect(hasExtras('string')).not.toBeTruthy();
|
||||
expect(hasExtras(1)).not.toBeTruthy();
|
||||
|
@ -23,13 +23,20 @@
|
||||
function fakePolicy() {
|
||||
return {
|
||||
then: function(successFn, errorFn) {
|
||||
if (policy.allowed) { successFn(); }
|
||||
else { errorFn(); }
|
||||
if (policy.allowed) {
|
||||
successFn();
|
||||
} else {
|
||||
errorFn();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function fakePromise() { return { success: angular.noop }; }
|
||||
function fakeToast() { return { add: angular.noop }; }
|
||||
function fakePromise() {
|
||||
return { success: angular.noop };
|
||||
}
|
||||
function fakeToast() {
|
||||
return { add: angular.noop };
|
||||
}
|
||||
|
||||
var controller, toastService, policyAPI, keystoneAPI;
|
||||
|
||||
|
@ -30,7 +30,9 @@
|
||||
it('has correct disk configuration options', function() {
|
||||
expect(ctrl.diskConfigOptions).toBeDefined();
|
||||
expect(ctrl.diskConfigOptions.length).toBe(2);
|
||||
var vals = ctrl.diskConfigOptions.map(function(x) { return x.value; });
|
||||
var vals = ctrl.diskConfigOptions.map(function(x) {
|
||||
return x.value;
|
||||
});
|
||||
expect(vals).toContain('AUTO');
|
||||
expect(vals).toContain('MANUAL');
|
||||
});
|
||||
|
@ -401,7 +401,9 @@
|
||||
describe('defaultIfUndefined', function () {
|
||||
|
||||
it('returns the given default if value is undefined', function () {
|
||||
/*eslint-disable no-undefined */
|
||||
expect(ctrl.defaultIfUndefined(undefined, 'defValue')).toBe('defValue');
|
||||
/*eslint-enable no-undefined */
|
||||
});
|
||||
|
||||
it('returns the value if defined', function () {
|
||||
|
@ -108,7 +108,9 @@
|
||||
// This table used in "allocated" portion of transfer table
|
||||
scope.showSearchBar = false;
|
||||
// Always show items
|
||||
scope.showItemFunc = function () { return true; };
|
||||
scope.showItemFunc = function () {
|
||||
return true;
|
||||
};
|
||||
scope.itemClickAction = transferTableController.deallocate;
|
||||
scope.noneAvailableText = transferTableHelpText.noneAllocText;
|
||||
scope.itemButtonClasses = "fa fa-minus";
|
||||
|
@ -72,7 +72,10 @@
|
||||
spyOn(modal, 'open').and
|
||||
.returnValue({
|
||||
result: {
|
||||
then: function(x, y) { successFunc = x; errFunc = y; }
|
||||
then: function(x, y) {
|
||||
successFunc = x;
|
||||
errFunc = y;
|
||||
}
|
||||
}
|
||||
});
|
||||
func(launchContext);
|
||||
@ -88,7 +91,10 @@
|
||||
spyOn(modal, 'open').and
|
||||
.returnValue({
|
||||
result: {
|
||||
then: function(x, y) { successFunc = x; errFunc = y; }
|
||||
then: function(x, y) {
|
||||
successFunc = x;
|
||||
errFunc = y;
|
||||
}
|
||||
}
|
||||
});
|
||||
func(launchContext);
|
||||
|
@ -407,7 +407,7 @@
|
||||
* size for validating vol_size field
|
||||
*/
|
||||
function checkVolumeForImage() {
|
||||
var source = selection ? selection[0] : undefined;
|
||||
var source = selection[0];
|
||||
|
||||
if (source && ctrl.currentBootSource === bootSourceTypes.IMAGE) {
|
||||
var imageGb = source.size * 1e-9;
|
||||
@ -418,7 +418,9 @@
|
||||
var volumeSizeObj = { minVolumeSize: ctrl.minVolumeSize };
|
||||
ctrl.minVolumeSizeError = interpolate(volumeSizeText, volumeSizeObj, true);
|
||||
} else {
|
||||
/*eslint-disable no-undefined */
|
||||
ctrl.minVolumeSize = undefined;
|
||||
/*eslint-enable no-undefined */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,9 @@
|
||||
it('defines the correct boot source options', function() {
|
||||
expect(ctrl.bootSourcesOptions).toBeDefined();
|
||||
var types = ['image', 'snapshot', 'volume', 'volume_snapshot'];
|
||||
var opts = ctrl.bootSourcesOptions.map(function(x) { return x.type; });
|
||||
var opts = ctrl.bootSourcesOptions.map(function(x) {
|
||||
return x.type;
|
||||
});
|
||||
types.forEach(function(key) {
|
||||
expect(opts).toContain(key);
|
||||
});
|
||||
|
@ -39,7 +39,7 @@
|
||||
});
|
||||
|
||||
it('returns Image for undefined', function () {
|
||||
expect(imageTypeFilter(undefined)).toBe('Image');
|
||||
expect(imageTypeFilter()).toBe('Image');
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -21,9 +21,15 @@
|
||||
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||
|
||||
beforeEach(module(function($provide) {
|
||||
cinderAPI = {getExtensions: function() {return {then: angular.noop}; }};
|
||||
q = {defer: function() { return {resolve: angular.noop}; }};
|
||||
$provide.value('$cacheFactory', function() {return "cache"; });
|
||||
cinderAPI = {getExtensions: function() {
|
||||
return {then: angular.noop};
|
||||
}};
|
||||
q = {defer: function() {
|
||||
return {resolve: angular.noop};
|
||||
}};
|
||||
$provide.value('$cacheFactory', function() {
|
||||
return "cache";
|
||||
});
|
||||
$provide.value('$q', q);
|
||||
$provide.value('horizon.app.core.openstack-service-api.cinder', cinderAPI);
|
||||
}));
|
||||
|
@ -63,7 +63,9 @@
|
||||
function testCall(apiService, service, toastService, config) {
|
||||
// 'promise' simulates a promise, including a self-referential success
|
||||
// handler.
|
||||
var promise = {error: angular.noop, success: function() { return this; }};
|
||||
var promise = {error: angular.noop, success: function() {
|
||||
return this;
|
||||
}};
|
||||
spyOn(apiService, config.method).and.returnValue(promise);
|
||||
spyOn(promise, 'error');
|
||||
service[config.func].apply(null, config.testInput);
|
||||
|
@ -275,7 +275,7 @@
|
||||
* filters. For example "name" : "fedora" would filter on the fedora name.
|
||||
*/
|
||||
function getImages(params) {
|
||||
var config = (params) ? { 'params' : params} : {};
|
||||
var config = params ? { 'params' : params} : {};
|
||||
return apiService.get('/api/glance/images/', config)
|
||||
.error(function () {
|
||||
toastService.add('error', gettext('Unable to retrieve the images.'));
|
||||
@ -340,7 +340,7 @@
|
||||
* enabled.
|
||||
*/
|
||||
function getNamespaces(params, suppressError) {
|
||||
var config = (params) ? {'params' : params} : {};
|
||||
var config = params ? {'params' : params} : {};
|
||||
config.cache = true;
|
||||
|
||||
var promise = apiService.get('/api/glance/metadefs/namespaces/', config);
|
||||
|
@ -72,7 +72,7 @@
|
||||
|
||||
// Users
|
||||
function getUsers(params) {
|
||||
var config = (params) ? {'params': params} : {};
|
||||
var config = params ? {'params': params} : {};
|
||||
return apiService.get('/api/keystone/users/', config)
|
||||
.error(function () {
|
||||
toastService.add('error', gettext('Unable to retrieve the users.'));
|
||||
@ -247,7 +247,7 @@
|
||||
|
||||
// Projects
|
||||
function getProjects(params) {
|
||||
var config = (params) ? {'params': params} : {};
|
||||
var config = params ? {'params': params} : {};
|
||||
return apiService.get('/api/keystone/projects/', config)
|
||||
.error(function () {
|
||||
toastService.add('error', gettext('Unable to retrieve the projects.'));
|
||||
|
@ -23,9 +23,15 @@
|
||||
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||
|
||||
beforeEach(module(function($provide) {
|
||||
novaAPI = {getExtensions: function() {return {then: angular.noop}; }};
|
||||
q = {defer: function() { return {resolve: angular.noop}; }};
|
||||
$provide.value('$cacheFactory', function() {return "cache"; });
|
||||
novaAPI = {getExtensions: function() {
|
||||
return {then: angular.noop};
|
||||
}};
|
||||
q = {defer: function() {
|
||||
return {resolve: angular.noop};
|
||||
}};
|
||||
$provide.value('$cacheFactory', function() {
|
||||
return "cache";
|
||||
});
|
||||
$provide.value('$q', q);
|
||||
$provide.value('horizon.app.core.openstack-service-api.nova', novaAPI);
|
||||
}));
|
||||
|
@ -281,8 +281,12 @@
|
||||
*/
|
||||
function getFlavors(isPublic, getExtras) {
|
||||
var config = {'params': {}};
|
||||
if (isPublic) { config.params.is_public = 'true'; }
|
||||
if (getExtras) { config.params.get_extras = 'true'; }
|
||||
if (isPublic) {
|
||||
config.params.is_public = 'true';
|
||||
}
|
||||
if (getExtras) {
|
||||
config.params.get_extras = 'true';
|
||||
}
|
||||
return apiService.get('/api/nova/flavors/', config)
|
||||
.success(function (data) {
|
||||
// The colon character ':' in the flavor data causes problems when used
|
||||
@ -319,8 +323,12 @@
|
||||
*/
|
||||
function getFlavor(id, getExtras, getAccessList) {
|
||||
var config = {'params': {}};
|
||||
if (getExtras) { config.params.get_extras = 'true'; }
|
||||
if (getAccessList) { config.params.get_access_list = 'true'; }
|
||||
if (getExtras) {
|
||||
config.params.get_extras = 'true';
|
||||
}
|
||||
if (getAccessList) {
|
||||
config.params.get_access_list = 'true';
|
||||
}
|
||||
return apiService.get('/api/nova/flavors/' + id + '/' , config)
|
||||
.error(function () {
|
||||
toastService.add('error', gettext('Unable to retrieve the flavor.'));
|
||||
|
@ -108,8 +108,12 @@
|
||||
return deferred.promise;
|
||||
|
||||
function success(response) {
|
||||
if (response.data.allowed) { deferred.resolve(); }
|
||||
else { deferred.reject(); }
|
||||
if (response.data.allowed) {
|
||||
deferred.resolve();
|
||||
}
|
||||
else {
|
||||
deferred.reject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,13 +70,17 @@
|
||||
};
|
||||
|
||||
var deferred = {
|
||||
then: function(callback) { callback(response); },
|
||||
then: function(callback) {
|
||||
callback(response);
|
||||
},
|
||||
reject: angular.noop,
|
||||
resolve: angular.noop
|
||||
};
|
||||
|
||||
var service;
|
||||
var q = { defer: function() { return deferred; }};
|
||||
var q = { defer: function() {
|
||||
return deferred;
|
||||
}};
|
||||
|
||||
////////////////
|
||||
|
||||
|
@ -28,10 +28,18 @@
|
||||
userSession = {get: angular.noop};
|
||||
$provide.value('horizon.app.core.openstack-service-api.userSession', userSession);
|
||||
deferred = {promise: angular.noop, reject: angular.noop, resolve: angular.noop};
|
||||
q = {all: function() {return {then: angular.noop}; },
|
||||
defer: function() { return deferred; }};
|
||||
q = {
|
||||
all: function() {
|
||||
return {then: angular.noop};
|
||||
},
|
||||
defer: function() {
|
||||
return deferred;
|
||||
}
|
||||
};
|
||||
$provide.value('$q', q);
|
||||
$provide.value('$cacheFactory', function() { return 'cache'; });
|
||||
$provide.value('$cacheFactory', function() {
|
||||
return 'cache';
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(
|
||||
|
@ -24,7 +24,9 @@
|
||||
beforeEach(module(function($provide) {
|
||||
keystoneAPI = {getCurrentUserSession: angular.noop};
|
||||
$provide.value('horizon.app.core.openstack-service-api.keystone', keystoneAPI);
|
||||
$provide.value('$cacheFactory', function() { return 'cache'; });
|
||||
$provide.value('$cacheFactory', function() {
|
||||
return 'cache';
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(inject(['horizon.app.core.openstack-service-api.userSession', function(userSession) {
|
||||
|
@ -24,7 +24,9 @@
|
||||
ctrl.copyFrom = angular.element('#id_image_url').val();
|
||||
ctrl.diskFormat = angular.element('#id_disk_format option:selected').val();
|
||||
ctrl.selectImageFormat = function (path) {
|
||||
if (!path) { return; }
|
||||
if (!path) {
|
||||
return;
|
||||
}
|
||||
var format = path.substr(path.lastIndexOf(".") + 1).toLowerCase().replace(/[^a-z0-9]+/gi, "");
|
||||
|
||||
/* eslint-disable angular/ng_angularelement */
|
||||
|
Loading…
Reference in New Issue
Block a user