appsflare/ludicrum-api

View on GitHub

Showing 35 of 78 total issues

Function exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(grunt) {


    // Load the include-all library in order to require all of our grunt
    // configurations and task registrations dynamically.
Severity: Minor
Found in Gruntfile.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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (req, res, next) {

  var grantType = req.param('grant_type');
  if (!grantType) {
    return res.send(400, 'missing grant_type parameter');
Severity: Minor
Found in api/policies/isTrustedClient.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 saveFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.saveFile = function (options, filePath, callback, errCallback) {


  if (!options) {
    options = {};
Severity: Minor
Found in api/services/GFS.js - About 1 hr to fix

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

    let streamFile = function (readOptions, req, res) {
      "use strict";
    
      //Retrieve file metadata information and then serve the file
      Files.findOne(readOptions)
    Severity: Minor
    Found in api/controllers/FileController.js - About 1 hr to fix

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

              function connect(transports) {
                if (self.transport) self.transport.clearTimeouts();
      
                self.transport = self.getTransport(transports);
                if (!self.transport) return self.publish('connect_failed');
      Severity: Minor
      Found in assets/js/socket.io.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                        if (v) {
                          partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
        Severity: Major
        Found in assets/js/socket.io.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                          }
          Severity: Major
          Found in assets/js/socket.io.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (client.trusted) {
                          return next();
                        } else {
                          return res.send(401, 'resource owner password flow is not allowed');
                        }
            Severity: Major
            Found in api/policies/isTrustedClient.js - About 45 mins to fix

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

              let streamFile = function (readOptions, req, res) {
                "use strict";
              
                //Retrieve file metadata information and then serve the file
                Files.findOne(readOptions)
              Severity: Minor
              Found in api/controllers/FileController.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

              Avoid deeply nested control flow statements.
              Open

                          if (!client) {
                            return res.send(404, "Client with client id " + clientId + " not found");
                          }
              Severity: Major
              Found in api/policies/isTrustedClient.js - About 45 mins to fix

                Function forbidden has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function forbidden (data, options) {
                
                  // Get access to `req`, `res`, & `sails`
                  var req = this.req;
                  var res = this.res;
                Severity: Minor
                Found in api/responses/forbidden.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 badRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function badRequest(data, options) {
                
                  // Get access to `req`, `res`, & `sails`
                  var req = this.req;
                  var res = this.res;
                Severity: Minor
                Found in api/responses/badRequest.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 login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  login: function (req, res) {
                
                    passport.authenticate(
                      'local',
                      function (err, user, info) {
                Severity: Minor
                Found in api/controllers/AuthController.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 notFound has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function notFound (data, options) {
                
                  // Get access to `req`, `res`, & `sails`
                  var req = this.req;
                  var res = this.res;
                Severity: Minor
                Found in api/responses/notFound.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 serverError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function serverError (data, options) {
                
                  // Get access to `req`, `res`, & `sails`
                  var req = this.req;
                  var res = this.res;
                Severity: Minor
                Found in api/responses/serverError.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