dataplug-io/hubspot-dataplug

View on GitHub

Showing 8 of 18 total issues

File contacts.js has 448 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const _ = require('lodash')
const { URL } = require('url')
const moment = require('moment')
const { Source, Mapper } = require('@dataplug/dataplug')
const { HttpGetReader, PagedHttpGetReader } = require('@dataplug/dataplug-http')
Severity: Minor
Found in lib/collections/contacts.js - About 6 hrs to fix

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

    const factory = (params) => {
      params = _.clone(params)
    
      let uri = '/contacts/v1/lists/all/contacts/all'
      if (params.recently === 'created') {
    Severity: Minor
    Found in lib/collections/contacts.js - About 2 hrs 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 factory has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const factory = (params) => {
      params = _.clone(params)
    
      let uri = '/contacts/v1/lists/all/contacts/all'
      if (params.recently === 'created') {
    Severity: Major
    Found in lib/collections/contacts.js - About 2 hrs to fix

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

      const factory = (params) => {
        params = _.clone(params)
      
        let uri = '/companies/v2/companies/paged'
        let selector = '!.companies.*'
      Severity: Major
      Found in lib/collections/companies.js - About 2 hrs to fix

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

        const factory = (params) => {
          params = _.clone(params)
        
          let uri = '/deals/v1/deal/paged'
          let selector = '!.deals.*'
        Severity: Major
        Found in lib/collections/deals.js - About 2 hrs to fix

          Function factory has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          const factory = (params) => {
            params = _.clone(params)
          
            let uri = '/companies/v2/companies/paged'
            let selector = '!.companies.*'
          Severity: Minor
          Found in lib/collections/companies.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 factory has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          const factory = (params) => {
            params = _.clone(params)
          
            let uri = '/deals/v1/deal/paged'
            let selector = '!.deals.*'
          Severity: Minor
          Found in lib/collections/deals.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 responseHandlerFactory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function responseHandlerFactory (params) {
            return (response, request) => {
              if (response.statusCode === 429) {
                let body = ''
                request
          Severity: Minor
          Found in lib/responseHandlerFactory.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language