ddo/oauth-1.0a

View on GitHub

Showing 5 of 5 total issues

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

function OAuth(opts) {
    if(!(this instanceof OAuth)) {
        return new OAuth(opts);
    }

Severity: Minor
Found in oauth-1.0a.js - About 1 hr to fix

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

    function OAuth(opts) {
        if(!(this instanceof OAuth)) {
            return new OAuth(opts);
        }
    
    
    Severity: Minor
    Found in oauth-1.0a.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 getParameterString has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    OAuth.prototype.getParameterString = function(request, oauth_data) {
        var base_string_data;
        if (oauth_data.oauth_body_hash) {
            base_string_data = this.sortObject(this.percentEncodeData(this.mergeObject(oauth_data, this.deParamUrl(request.url))));
        } else {
    Severity: Minor
    Found in oauth-1.0a.js - About 1 hr to fix

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

      OAuth.prototype.deParam = function(string) {
          var arr = string.split('&');
          var data = {};
      
          for(var i = 0; i < arr.length; i++) {
      Severity: Minor
      Found in oauth-1.0a.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 getParameterString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      OAuth.prototype.getParameterString = function(request, oauth_data) {
          var base_string_data;
          if (oauth_data.oauth_body_hash) {
              base_string_data = this.sortObject(this.percentEncodeData(this.mergeObject(oauth_data, this.deParamUrl(request.url))));
          } else {
      Severity: Minor
      Found in oauth-1.0a.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

      Severity
      Category
      Status
      Source
      Language