jay-depot/turnpike

View on GitHub

Showing 36 of 58 total issues

Function Connection has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

function Connection(req, res, next) {
  var response = '';
  var headers  = {};
  var status   = 200;

Severity: Minor
Found in lib/classes/Connection.js - About 3 hrs to fix

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 Connection has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Connection(req, res, next) {
  var response = '';
  var headers  = {};
  var status   = 200;

Severity: Major
Found in lib/classes/Connection.js - About 3 hrs to fix

Function legacy has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

router.legacy = function() {
  var action = require('./action');
  var fs = require('fs-extra');
  var name, path, route, routes, verb, expressVerb;

Severity: Minor
Found in lib/router.js - About 3 hrs to fix

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 MemoryModel has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function MemoryModel() {
  var storage = [];
  var lastID = 0;

  console.warn("WARNING: You are using MemoryModel as the base for " + this.constructor.name);
Severity: Major
Found in lib/classes/base/collection/MemoryModel.js - About 2 hrs to fix

Function EndpointController has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function EndpointController(connection) {
  var application = require('./../../../index').application;

  this.connection = connection;
  this.view = this.name = this.constructor.name;
Severity: Major
Found in lib/classes/base/controller/EndpointController.js - About 2 hrs to fix

Function AccessControl has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var AccessControl = (function() {
  var rules = {};

  return {
    addRules: function (controller, imported) {
Severity: Major
Found in lib/server/AccessControl.js - About 2 hrs to fix

Function editForm has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

WebEndpointController.prototype.editForm = function(params, readyCallback) {
  var item;

  if (this.model) {
    item = {};
Severity: Major
Found in lib/classes/base/controller/WebEndpointController.js - About 2 hrs to fix

Function checkAccess has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    checkAccess: function (action, connection, callback) {
      action = action_helpers.parse(action);

      if (typeof(action) === 'string') {
        action = {
Severity: Minor
Found in lib/server/AccessControl.js - About 1 hr to fix

Function edit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

ResourceEndpointController.prototype.edit = function(item, readyCallback) {
  if (this.model){
    async.waterfall([
      function(next) {
        var modelField;
Severity: Minor
Found in lib/classes/base/controller/ResourceEndpointController.js - About 1 hr to fix

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 create_view has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function create_view(options, skeletons) {
  var Model;
  var Controller;
  var current_dir = process.cwd();

Severity: Minor
Found in bin/support/create_view.js - About 1 hr to fix

Function processWrangler has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function processWrangler(minProcs, maxSpares, respawnDelay, cb) {
  var crashing = false;
  minProcs = minProcs || require('os').cpus().length;
  maxSpares = maxSpares || Math.ceil(minProcs /  2); //Still not
  respawnDelay = respawnDelay || 1000;
Severity: Minor
Found in lib/internal/processWrangler.js - About 1 hr to fix

Function edit has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

RestEndpointController.prototype.edit = function(params, readyCallback) {
  if (this.model){
    async.waterfall([
      function(next) {
        var item = {};
Severity: Minor
Found in lib/classes/base/controller/RestEndpointController.js - About 1 hr to fix

Function ModelBase has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ModelBase() {
  //Item constructor.
  //Returns an empty Item as stored by this model.
  this.Item = this.Item || function() {
    this._id = undefined;
Severity: Minor
Found in lib/classes/base/collection/CollectionBase.js - About 1 hr to fix

Function drive has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drive() {
  require(process.cwd() + '/application/init.js');

  if (cluster.isMaster && !config.testing) {
    driver.fork(function(err, workers) {
Severity: Minor
Found in lib/server/drive.js - About 1 hr to fix

Function MemoryModel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function MemoryModel() {
  var storage = [];
  var lastID = 0;

  console.warn("WARNING: You are using MemoryModel as the base for " + this.constructor.name);
Severity: Minor
Found in lib/classes/base/collection/MemoryModel.js - About 1 hr to fix

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 ModelBase has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function ModelBase() {
  //Item constructor.
  //Returns an empty Item as stored by this model.
  this.Item = this.Item || function() {
    this._id = undefined;
Severity: Minor
Found in lib/classes/base/collection/CollectionBase.js - About 1 hr to fix

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 edit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ResourceEndpointController.prototype.edit = function(item, readyCallback) {
  if (this.model){
    async.waterfall([
      function(next) {
        var modelField;
Severity: Minor
Found in lib/classes/base/controller/ResourceEndpointController.js - About 1 hr to fix

Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

RestEndpointController.prototype.create = function(params, readyCallback) {
  if (this.model) {
    async.waterfall([
      function(next) {
        this.model.create(next);
Severity: Minor
Found in lib/classes/base/controller/RestEndpointController.js - About 1 hr to fix

Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ResourceEndpointController.prototype.create = function(readyCallback) {
  if (this.model) {
    async.waterfall([
      function(next) {
        this.model.create(next);
Severity: Minor
Found in lib/classes/base/controller/ResourceEndpointController.js - About 1 hr to fix

Function AccessControl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

var AccessControl = (function() {
  var rules = {};

  return {
    addRules: function (controller, imported) {
Severity: Minor
Found in lib/server/AccessControl.js - About 1 hr to fix

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

Severity
Category
Status
Source
Language