maykinmedia/consumerjs

View on GitHub

Showing 10 of 10 total issues

Function exports has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (config) {
if (process.env.CI && (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY)) {
throw ConfigException('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.')
}
 
 
Severity: Major
Found in karma.conf.js - About 3 hrs to fix

    Function diff has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    export function diff(objOld, objNew) { // jshint maxdepth:3
    let result = {};
     
    for (let key of Object.keys(objNew)) {
    let valueOld = (objOld) ? objOld[key] : null,
    Severity: Minor
    Found in src/utils.js - About 2 hrs to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    patch(path = '', data = {}, query = {}) {
    let uri = URI.build({'path': path, 'query': URI.buildQuery(query)});
    return this.request('patch', uri, data);
    }
    Severity: Major
    Found in src/abstract-consumer.js and 2 other locations - About 2 hrs to fix
    src/abstract-consumer.js on lines 104..107
    src/abstract-consumer.js on lines 115..118

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    put(path = '', data = {}, query = {}) {
    let uri = URI.build({'path': path, 'query': URI.buildQuery(query)});
    return this.request('put', uri, data);
    }
    Severity: Major
    Found in src/abstract-consumer.js and 2 other locations - About 2 hrs to fix
    src/abstract-consumer.js on lines 93..96
    src/abstract-consumer.js on lines 104..107

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    post(path = '', data = {}, query = {}) {
    let uri = URI.build({'path': path, 'query': URI.buildQuery(query)});
    return this.request('post', uri, data);
    }
    Severity: Major
    Found in src/abstract-consumer.js and 2 other locations - About 2 hrs to fix
    src/abstract-consumer.js on lines 93..96
    src/abstract-consumer.js on lines 115..118

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    next() {
    if (typeof this.responseData.next !== 'string') {
    return Promise.resolve(this);
    }
     
     
    Severity: Major
    Found in src/linked-page-number-list.js and 1 other location - About 1 hr to fix
    src/linked-page-number-list.js on lines 15..22

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    previous() {
    if (typeof this.responseData.previous !== 'string') {
    return Promise.resolve(this);
    }
     
     
    Severity: Major
    Found in src/linked-page-number-list.js and 1 other location - About 1 hr to fix
    src/linked-page-number-list.js on lines 28..35

    Function diff has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function diff(objOld, objNew) { // jshint maxdepth:3
    let result = {};
     
    for (let key of Object.keys(objNew)) {
    let valueOld = (objOld) ? objOld[key] : null,
    Severity: Minor
    Found in src/utils.js - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      else if (isObject(valueNew)) {
      let objDiff = diff(valueOld, valueNew);
       
      // No items in object (inital value), discard this key.
      if (!Object.keys(objDiff).length) {
      Severity: Major
      Found in src/utils.js and 1 other location - About 1 hr to fix
      src/utils.js on lines 22..54

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      if (Array.isArray(valueNew)) {
      let objDiff = diff(valueNew, valueOld);
       
      // No items in object (inital value), discard this key.
      if (!Object.keys(objDiff).length) {
      Severity: Major
      Found in src/utils.js and 1 other location - About 1 hr to fix
      src/utils.js on lines 35..54
      Severity
      Category
      Status
      Source
      Language