Showing 204 of 440 total issues
Function skuChassisParamHandler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var skuChassisParamHandler = function(context, value) {
var injector = require('../../index.js').injector;
var nodeServiceApi = injector.get('Http.Services.Api.Nodes');
return nodeServiceApi.getAllNodes({
or: [
Function _onMetadata
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var _onMetadata = function(stream, query, filename, id, metadata) {
var self = this;
return self.createOrUpdateEntry({
basename: query,
Function editNodeRelations
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
NodeApiService.prototype.editNodeRelations = function(id, body, handler) {
var self = this;
return waterline.nodes.needByIdentifier(id).bind({})
.then(function(node) {
this.parentNode = node;
Function updateObmById
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ObmApiService.prototype.updateObmById = function(obmId, values) {
return waterline.obms.needByIdentifier(obmId)
.then(function(oldObm) {
/* Get nodes that need to publish events */
if (oldObm.node && !values.nodeId) {
Function getLcLogService
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getLcLogService = controller(function(req, res) {
var identifier = req.swagger.params.identifier.value;
return redfish.getVendorNameById(identifier)
.then(function(result){
Function publishTaskProgress
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
NotificationApiService.prototype.publishTaskProgress = function(message) {
var progressData;
return Promise.try(function() {
message.value = parseInt(message.value);
message.maximum = parseInt(message.maximum);
Function listVolume
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var listVolume = controller(function(req, res) {
var identifier = req.swagger.params.identifier.value;
var index = req.swagger.params.index.value;
return redfish.getVendorNameById(identifier)
Function handleError
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
rest.handleError = function () {
return function handleErrorMiddleware(err, req, res, next) {
// TODO - implement custom error type serializers
if (err instanceof Error || err instanceof ErrorEvent) {
var message = err.message || http.STATUS_CODES[err.status] || 'Unspecified Error';
Function workflowApiServiceFactory
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
eventsProtocol,
Logger,
Errors,
Promise,
Constants,
Function NotificationApiServiceFactory
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
eventsProtocol,
Logger,
waterline,
Errors,
Promise,
Function restFactory
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Serializable,
Promise,
_,
assert,
util,
Function rest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function rest(callback, options) {
assert.func(callback, 'callback function is required');
assert.optionalObject(options, 'options should be an optional object');
options = options || {};
Function factory
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function factory(Promise, Errors, waterline, uuid, assert, _, fs) {
fs = Promise.promisifyAll(fs);
function FileManager(config) {
- 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 swaggerValidator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function swaggerValidator() {
var namespace = '/api/2.0/schemas/';
var schemaPath = path.resolve(__dirname, '../../static/schemas/2.0');
var namespace1Added = schemaApiService.addNamespace(schemaPath, namespace);
Function swagger_authn_authz
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function swagger_authn_authz(context, next) { // jshint ignore:line
if(context.request.user) {
ready.then(function() {
return authz.aclMethod('isAllowed',
context.request.user,
Function authMiddlewareLogin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
AuthService.prototype.authMiddlewareLogin = function(req, res, next) {
var self = this;
passport.authenticate('local', {
session: false
Function modifyUser
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var modifyUser = controller(function(req) {
var name = req.swagger.params.name.value;
var userObj = _.pick(req.swagger.params.body.value, ['password', 'role']);
var configureUsersAllows = ['password', 'role'];
var configureSelfAllows = ['password'];
Function putFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
FileStreamer.prototype.putFile = function(req, filename) {
var self = this;
return new Promise(function(resolve, reject) {
self.put(req, filename)
Function handleErrorMiddleware
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function handleErrorMiddleware(err, req, res, next) {
// TODO - implement custom error type serializers
if (err instanceof Error || err instanceof ErrorEvent) {
var message = err.message || http.STATUS_CODES[err.status] || 'Unspecified Error';
logger.error(message, {
Function LookupFactory
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function LookupFactory (Serializable) {
function Lookup (defaults) {
Serializable.call(
this,
Lookup.schema,