Showing 204 of 440 total issues
Function modifyUserByName
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
AccountApiService.prototype.modifyUserByName = function(name, info) {
var self = this;
return Promise.try(function() {
assert.string(name);
return waterline.localusers.findOne({username: name});
Function runRpc
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runRpc(funcName) {
var _arguments = Array.prototype.slice.call(arguments);
var args = _arguments.slice(1);
return getClient()
.then(function(client) {
Function runClientObserver
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
UPnPService.prototype.runClientObserver = function(address) {
var self = this;
self.client = new Client({unicastHost:address});
self.client.on('response', function inResponse(headers, code, info) {
var ttl = parseInt(headers['CACHE-CONTROL'].split('=')[1].trim());
Function accountApiServiceFactory
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
waterline,
Errors,
Logger,
_,
Promise,
Function firmwareCatalogsIdGet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var firmwareCatalogsIdGet = controller(function(req) {
return catalogs.getFirmwareCatalogById(req.swagger.params.identifier.value)
.then(function (result){
var data = {};
if (result){
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function factory
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function factory(Promise, Errors, waterline, uuid, assert, _, fs) {
Function NodeFactory
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Promise,
Serializable,
ObmSerializable,
SnmpSerializable,
SshSerializable,
Avoid deeply nested control flow statements. Open
if (typeof options.ipv6 === 'undefined' ) {
options.ipv6 = [];
}
Function getSessions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var getSessions = controller(function(req, res) {
var options = redfish.makeOptions(req, res);
options.sessions = _.filter(auth.getRedfishSession(), function(session) {
if( req.isAuthenticated && req.isAuthenticated() ) {
if( req.hasRole('Administrator') || req.hasRole('ConfigureUsers') ||
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
} else if (!foundComponent) {
logger.debug("Couldn't compute the match of " + amqpMessage.data.OriginOfCondition);
return amqpMessage;
}
Avoid deeply nested control flow statements. Open
if (id === driveIndex && typeof drive.SMART.Identity["Rotation Rate"] !== 'undefined') {
return drive;
}
Avoid deeply nested control flow statements. Open
if (typeof options.ipv6 !== "undefined") {
delete options.ipv6;
}
Function pollerApiServiceFactory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
waterline,
taskProtocol,
Errors,
_,
Promise,
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function create(fittingDef, bagpipes) {
injector = require('../../index.js').injector;
var authz = injector.get('Http.Services.Api.Account');
var swaggerNodeRunner = bagpipes.config.swaggerNodeRunner;
var ready = loadSwagger(authz, swaggerNodeRunner.swagger);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (typeof options.ipv4 === 'undefined' ) {
options.ipv4 = [];
}
Avoid deeply nested control flow statements. Open
if (
parseInt(alertDiskSlot) === parseInt(catalogedComponentDiskSlot)
&& !foundComponent) {
foundComponent = true;
amqpMessage = updateSnPn(amqpMessage, catalogedComponent);
Avoid deeply nested control flow statements. Open
if(!(id in controllers)) {
controllers[id] = [];
}
Avoid deeply nested control flow statements. Open
if (fwTypes[FWType] === undefined) {
fwTypes[FWType] = [entry];
} else {
fwTypes[FWType].push(entry);
}
Function wsmanServiceFactory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
waterline,
encryption,
configuration,
WsmanTool,
errors,
Avoid deeply nested control flow statements. Open
if (fwTypes[FWType] === undefined) {
fwTypes[FWType] = [entry];
} else {
fwTypes[FWType].push(entry);
}