passport-next/passport-facebook

View on GitHub

Showing 6 of 12 total issues

Function parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

exports.parse = function parse(json) {
  if (typeof json === 'string') {
    json = JSON.parse(json);
  }

Severity: Minor
Found in lib/profile.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 parse has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.parse = function parse(json) {
  if (typeof json === 'string') {
    json = JSON.parse(json);
  }

Severity: Minor
Found in lib/profile.js - About 1 hr to fix

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

    Strategy.prototype.userProfile = function userProfile(accessToken, done) {
      let url = uri.parse(this._profileURL);
      if (this._enableProof) {
        // Secure API call by adding proof of the app secret.  This is required when
        // the "Require AppSecret Proof for Server API calls" setting has been
    Severity: Minor
    Found in lib/strategy.js - About 1 hr to fix

      Function userProfile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      Strategy.prototype.userProfile = function userProfile(accessToken, done) {
        let url = uri.parse(this._profileURL);
        if (this._enableProof) {
          // Secure API call by adding proof of the app secret.  This is required when
          // the "Require AppSecret Proof for Server API calls" setting has been
      Severity: Minor
      Found in lib/strategy.js - About 55 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 FacebookTokenError has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function FacebookTokenError(message, type, code, subcode, traceID) {
      Severity: Minor
      Found in lib/errors/facebooktokenerror.js - About 35 mins to fix

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

        function FacebookGraphAPIError(message, type, code, subcode, traceID) {
        Severity: Minor
        Found in lib/errors/facebookgraphapierror.js - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language