dimitri-koenig/simple-vertec-api

View on GitHub

Showing 12 of 66 total issues

File simple-vertec-query.test.js has 1535 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {SimpleVertecApi, SimpleVertecQuery} from '../lib/index';
import {expect} from 'chai';
import sinon from 'sinon';
import q from 'bluebird';
import _ from 'lodash';
Severity: Major
Found in test/simple-vertec-query.test.js - About 4 days to fix

    File simple-vertec-api.test.js has 750 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {SimpleVertecApi} from '../lib/index';
    import {expect} from 'chai';
    import sinon from 'sinon';
    import xmlDigester from 'xml-digester';
    import q from 'bluebird';
    Severity: Major
    Found in test/simple-vertec-api.test.js - About 1 day to fix

      File simple-vertec-api.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from 'lodash';
      import SimpleXmlConverter from 'simple-xml-converter';
      import ParamsInjector from 'simple-parameter-injector';
      import xmlDigester from 'xml-digester';
      import q from 'bluebird';
      Severity: Minor
      Found in lib/simple-vertec-api.js - About 3 hrs to fix

        SimpleVertecQuery has 27 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class SimpleVertecQuery {
            /**
             * Sets global api for every instance
             *
             * @param {SimpleVertecApi} api An instance of SimpleVertecApi
        Severity: Minor
        Found in lib/simple-vertec-query.js - About 3 hrs to fix

          SimpleVertecApi has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class SimpleVertecApi {
              constructor(xmlUrl, authUrl, username, password, verbose, defaultRequestOptions) { // eslint-disable-line max-params
                  vertecXmlUrl = xmlUrl;
                  vertecAuthUrl = authUrl;
                  vertecUsername = username;
          Severity: Minor
          Found in lib/simple-vertec-api.js - About 2 hrs to fix

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

                doRequest(xmlString) {
                    let requestOptions = _.extend({
                        uri: vertecXmlUrl,
                        method: 'POST',
                        headers: {
            Severity: Major
            Found in lib/simple-vertec-api.js - About 2 hrs to fix

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

                  get(refresh = false) {
                      if (this.options.useParallelMode && this.options.query.objref) {
                          let ids = _.isArray(this.options.query.objref) ? _.clone(this.options.query.objref) : [this.options.query.objref];
              
                          return q.map(ids, id => {
              Severity: Major
              Found in lib/simple-vertec-query.js - About 2 hrs to fix

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

                    save() {
                        let saveData = [];
                
                        if (arguments.length === 1 && _.isArray(arguments[0])) {
                            saveData = arguments[0];
                Severity: Minor
                Found in lib/simple-vertec-api.js - About 1 hr to fix

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

                      log() {
                          /* istanbul ignore next: makes no sense to test this */
                          if (this.verbose === true) {
                              let content;
                              for (let i = 0; i < arguments.length; i++) {
                  Severity: Minor
                  Found in lib/simple-vertec-api.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 buildSelectObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      buildSelectObject() {
                          let query = arguments[0];
                          let params = arguments.length === 3 ? arguments[1] : null;
                          let fields = arguments.length === 3 ? arguments[2] : arguments[1];
                  
                  
                  Severity: Minor
                  Found in lib/simple-vertec-api.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 getAuthToken has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      getAuthToken() {
                          if (this.authTokenPromise) {
                              return this.authTokenPromise;
                          }
                  
                  
                  Severity: Minor
                  Found in lib/simple-vertec-api.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

                  Function requestRetryStrategy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      requestRetryStrategy(err, response) {
                          let check = (err !== null)
                              || !_.isObject(response)
                              || (response.statusCode > 400)
                              || (response.statusCode === 400 && (!_.isString(response.body) || (_.isString(response.body) && response.body.indexOf('token') === -1))) // we'll handle invalid tokens somewhere else
                  Severity: Minor
                  Found in lib/simple-vertec-api.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