Showing 204 of 440 total issues
Function modifyUserByName
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
AccountApiService.prototype.modifyUserByName = function(name, info) {
var self = this;
return Promise.try(function() {
assert.string(name);
return waterline.localusers.findOne({username: name});
Function runClientObserver
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 runRpc
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function runRpc(funcName) {
var _arguments = Array.prototype.slice.call(arguments);
var args = _arguments.slice(1);
return getClient()
.then(function(client) {
Function accountApiServiceFactory
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
waterline,
Errors,
Logger,
_,
Promise,
Function firmwareCatalogsIdGet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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 NodeFactory
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Promise,
Serializable,
ObmSerializable,
SnmpSerializable,
SshSerializable,
Function factory
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function factory(Promise, Errors, waterline, uuid, assert, _, fs) {
Avoid deeply nested control flow statements. Open
Open
if (typeof options.ipv6 !== "undefined") {
delete options.ipv6;
}
Function getSessions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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
Open
if (fwTypes[FWType] === undefined) {
fwTypes[FWType] = [entry];
} else {
fwTypes[FWType].push(entry);
}
Avoid deeply nested control flow statements. Open
Open
if (typeof options.ipv4 === 'undefined' ) {
options.ipv4 = [];
}
Avoid deeply nested control flow statements. Open
Open
if (typeof options.ipv6 === 'undefined' ) {
options.ipv6 = [];
}
Avoid deeply nested control flow statements. Open
Open
if (
parseInt(alertDiskSlot) === parseInt(catalogedComponentDiskSlot)
&& !foundComponent) {
foundComponent = true;
amqpMessage = updateSnPn(amqpMessage, catalogedComponent);
Avoid deeply nested control flow statements. Open
Open
if (fwTypes[FWType] === undefined) {
fwTypes[FWType] = [entry];
} else {
fwTypes[FWType].push(entry);
}
Avoid deeply nested control flow statements. Open
Open
if (id === driveIndex && typeof drive.SMART.Identity["Rotation Rate"] !== 'undefined') {
return drive;
}
Avoid deeply nested control flow statements. Open
Open
if (diskSlotFormat === 2) {
//Dell 730: Disk.Bay.1-18 = Disk.Bay.18:Enclosure.Internal.0-1:RAID.Integrated.1-1
catalogedComponentDiskSlot = parseInt(catalogedComponent.fqdd.split(".")[2].split("-")[1]);
}
Avoid deeply nested control flow statements. Open
Open
if (typeof options.ipv4 === 'undefined') {
options.ipv4 = [];
var ip4 = {
ipaddr: ipaddress
};
Avoid deeply nested control flow statements. Open
Open
if(!(id in controllers)) {
controllers[id] = [];
}
Avoid deeply nested control flow statements. Open
Open
if (_.includes(fwTypeKeywords, prefix)) {
FWType = prefix + '-' + element["Firmware Version"];
entry = {
"Version": element["Firmware Version"],
"node": source["node"]
Function wsmanServiceFactory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
waterline,
encryption,
configuration,
WsmanTool,
errors,