PayMaya/PayMaya-Node-SDK

View on GitHub

Showing 7 of 7 total issues

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

    execute: function(callback) {
        if(!this.buyer) {
            callback("Missing buyer");
            return;
        }
Severity: Minor
Found in lib/paymaya/api/Checkout.js - About 1 hr to fix

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

        execute: function(data, callback) {
            var httpOptions = {
              url: this._httpConfig.getUrl(),
              method: this._httpConfig.getMethod(),
              headers: this._httpConfig.getHeaders(),
    Severity: Minor
    Found in lib/paymaya/core/HttpConnection.js - About 1 hr to fix

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

          set: function(callback) {
              if(!this.logoUrl) {
                  callback("Missing logoUrl");
                  return;
              }
      Severity: Minor
      Found in lib/paymaya/api/Customization.js - About 1 hr to fix

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

            execute: function(callback) {
                if(!this.buyer) {
                    callback("Missing buyer");
                    return;
                }
        Severity: Minor
        Found in lib/paymaya/api/Checkout.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 _execute has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            _execute: function(data, url, method, apiKey, callback) {
        Severity: Minor
        Found in lib/paymaya/core/APIManager.js - About 35 mins to fix

          Avoid too many return statements within this function.
          Open

                      return;
          Severity: Major
          Found in lib/paymaya/api/Customization.js - About 30 mins to fix

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

            function PaymayaApiError(httpStatusCode, errObj) {
                this.httpStatusCode = httpStatusCode;
                this.name = 'PaymayaApiError';
                if(errObj) {
                    this.code = errObj.code;
            Severity: Minor
            Found in lib/paymaya/core/PaymayaApiError.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