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';
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;
Function doRequest
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
doRequest(xmlString) {
let requestOptions = _.extend({
uri: vertecXmlUrl,
method: 'POST',
headers: {
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];
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++) {
- Read upRead up
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];
- Read upRead up
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;
}
- Read upRead up
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
- Read upRead up
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"