gerencianet/gn-api-sdk-node

View on GitHub

Showing 7 of 96 total issues

File gn-endpoints.spec.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var should = require('should');
var proxyquire = require('proxyquire');
var simple = require('simple-mock');
Severity: Minor
Found in test/gn-endpoints.spec.js - About 2 hrs to fix

    File gn-constants.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    module.exports = {
        URL: {
            DEFAULT: {
    Severity: Minor
    Found in lib/gn-constants.js - About 2 hrs to fix

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

      GnEndpoints.prototype.getParams = function (route) {
          var regex = /\:(\w+)/g;
          var query = '';
          var placeholders = route.match(regex) || [];
          var params = {};
      Severity: Major
      Found in lib/gn-endpoints.js - About 2 hrs to fix

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

        GnAuth.prototype.getAccessToken = function () {
            
            if (this.constants.URL.PIX.production == this.baseUrl || this.constants.URL.PIX.sandbox == this.baseUrl) {
                var data_credentials = this.clientId + ":" + this.clientSecret;
                var auth = Buffer.from(data_credentials).toString("base64");
        Severity: Minor
        Found in lib/gn-auth.js - About 1 hr to fix

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

          GnEndpoints.prototype.directReqCallback = function (raw_response) {
          
              if(raw_response.data){
                  if(raw_response.status < 300){
                      if (raw_response.data.data){
          Severity: Minor
          Found in lib/gn-endpoints.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          GnEndpoints.prototype.run = function (name, params, body) {
              this.defer = q.defer();
              if (this.constants.ENDPOINTS.PIX.hasOwnProperty(name)) {
                  try {
                      this.certificate = fs.readFileSync(this.options.pathCert);
          Severity: Minor
          Found in lib/gn-endpoints.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 getParams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          GnEndpoints.prototype.getParams = function (route) {
              var regex = /\:(\w+)/g;
              var query = '';
              var placeholders = route.match(regex) || [];
              var params = {};
          Severity: Minor
          Found in lib/gn-endpoints.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