jaredhanson/oauth2orize

View on GitHub

Showing 52 of 87 total issues

Function token has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function token(options, issue) {
  if (typeof options == 'function') {
    issue = options;
    options = undefined;
  }
Severity: Minor
Found in lib/grant/token.js - About 1 day 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 code has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function code(options, issue) {
  if (typeof options == 'function') {
    issue = options;
    options = undefined;
  }
Severity: Minor
Found in lib/grant/code.js - About 1 day 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 54 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(server, options, immediate, complete) {
  if (typeof options == 'function') {
    complete = immediate;
    immediate = options;
    options = undefined;
Severity: Minor
Found in lib/middleware/resume.js - About 1 day 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 51 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(options) {
  options = options || {};
  
  var mode = options.mode || 'direct'
    , fragment = options.fragment || ['token']
Severity: Minor
Found in lib/middleware/errorHandler.js - About 7 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 exports has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(options, issue) {
  if (typeof options == 'function') {
    issue = options;
    options = undefined;
  }
Severity: Minor
Found in lib/exchange/password.js - About 7 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 exports has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(options, issue) {
  if (typeof options == 'function') {
    issue = options;
    options = undefined;
  }
Severity: Minor
Found in lib/exchange/refreshToken.js - About 7 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 exports has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(options, issue) {
  if (typeof options == 'function') {
    issue = options;
    options = undefined;
  }
Severity: Minor
Found in lib/exchange/clientCredentials.js - About 7 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 token has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function token(options, issue) {
  if (typeof options == 'function') {
    issue = options;
    options = undefined;
  }
Severity: Major
Found in lib/grant/token.js - About 4 hrs to fix

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

    module.exports = function code(options, issue) {
      if (typeof options == 'function') {
        issue = options;
        options = undefined;
      }
    Severity: Major
    Found in lib/grant/code.js - About 4 hrs to fix

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

      module.exports = function(options, issue) {
        if (typeof options == 'function') {
          issue = options;
          options = undefined;
        }
      Severity: Minor
      Found in lib/exchange/authorizationCode.js - About 4 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 exports has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function(server, options, parse, complete) {
        if (typeof options == 'function') {
          complete = parse;
          parse = options;
          options = undefined;
      Severity: Minor
      Found in lib/middleware/decision.js - About 4 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 exports has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(server, options, validate, immediate, complete) {
        if (typeof options == 'function') {
          complete = immediate;
          immediate = validate;
          validate = options;
      Severity: Major
      Found in lib/middleware/authorization.js - About 4 hrs to fix

        Function grant has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        Server.prototype.grant = function(type, phase, fn) {
          if (typeof type == 'object') {
            // sig: grant(mod)
            var mod = type;
            if (mod.request) { this.grant(mod.name, 'request', mod.request); }
        Severity: Minor
        Found in lib/server.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 authorization has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          return function authorization(req, res, next) {
            
            var body = req.body || {}
              , type = req.query.response_type || body.response_type;
        
        
        Severity: Major
        Found in lib/middleware/authorization.js - About 3 hrs to fix

          Function exports has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(server, options, immediate, complete) {
            if (typeof options == 'function') {
              complete = immediate;
              immediate = options;
              options = undefined;
          Severity: Major
          Found in lib/middleware/resume.js - About 3 hrs to fix

            Function resume has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              return function resume(req, res, next) {
                if (!req.oauth2) { return next(new Error('OAuth2orize requires transaction support. Did you forget oauth2orize.transactionLoader(...)?')); }
                
                req.oauth2.user = req[userProperty];
                if (res.locals) {
            Severity: Major
            Found in lib/middleware/resume.js - About 3 hrs to fix

              Function exports has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function(options, issue) {
                if (typeof options == 'function') {
                  issue = options;
                  options = undefined;
                }
              Severity: Major
              Found in lib/exchange/password.js - About 2 hrs to fix

                Function validated has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function validated(err, client, redirectURI, webOrigin) {
                        // Set properties *before* next()'ing due to error.  The presence of a
                        // redirectURI being provided, even under error conditions, indicates
                        // that the client should be informed of the error via a redirect.
                        req.oauth2 = {};
                Severity: Major
                Found in lib/middleware/authorization.js - About 2 hrs to fix

                  Function exports has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function(options, issue) {
                    if (typeof options == 'function') {
                      issue = options;
                      options = undefined;
                    }
                  Severity: Major
                  Found in lib/exchange/refreshToken.js - About 2 hrs to fix

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

                    module.exports = function(options, issue) {
                      if (typeof options == 'function') {
                        issue = options;
                        options = undefined;
                      }
                    Severity: Major
                    Found in lib/exchange/clientCredentials.js - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language