endpoints/endpoints

View on GitHub

Showing 31 of 109 total issues

Function default has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (file, searchPaths) {
  if (!searchPaths) {
    throw new Error('No searchPaths specified.');
  }
  var result = null;
Severity: Minor
Found in src/application/lib/require_search.js - About 1 hr to fix

    Function format has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      JsonApiFormat.prototype.format = function format(model) {
        var includedRelations = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
        var mode = arguments.length <= 2 || arguments[2] === undefined ? 'read' : arguments[2];
    
        var store = this.store;
    Severity: Minor
    Found in es5/format-jsonapi/index.js - About 1 hr to fix

      Function process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        process (input, opts={}) {
          const {singleResult, relations, mode} = opts;
          let links;
          if (mode === 'relation') {
            links = this._relationshipLinks(input.sourceModel, input.relationName);
      Severity: Minor
      Found in src/format-jsonapi/index.js - About 45 mins 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 relate has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function relate(model, relationName, data, mode, transaction) {
      Severity: Minor
      Found in es5/store-bookshelf/lib/relate.js - About 35 mins to fix

        Function readForRelated has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export default function readForRelated (mode, sourceModel, id, relation, query) {
        Severity: Minor
        Found in src/store-bookshelf/lib/_read_for_related.js - About 35 mins to fix

          Function readForRelated has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function readForRelated(mode, sourceModel, id, relation, query) {
          Severity: Minor
          Found in es5/store-bookshelf/lib/_read_for_related.js - About 35 mins to fix

            Function relate has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function relate (model, relationName, data, mode, transaction) {
            Severity: Minor
            Found in src/store-bookshelf/lib/relate.js - About 35 mins to fix

              Function default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function(request, endpoint) {
                var err, isValidType, id;
                var data = request.body.data;
              
                // this is such horrible, horrible bullshit
              Severity: Minor
              Found in src/request-handler/lib/verify_data_object.js - About 35 mins 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 _createClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
              Severity: Minor
              Found in es5/controller/index.js - About 25 mins 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function(model) {
                if (!model) {
                  throw Kapow(404, 'Unable to locate model.');
                }
              
              
              Severity: Minor
              Found in src/request-handler/lib/throw_if_no_model.js - About 25 mins 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 _createClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
              Severity: Minor
              Found in es5/request-handler/index.js - About 25 mins 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