taskrabbit/elasticsearch-dump

View on GitHub

Showing 48 of 77 total issues

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

function parseBaseURL (_url, options = {}) {
  let host = _url.replace(/\/+$/, '')
  const hostParts = host.split('/')
  let index
  const indexParts = (options.index || '').split('/').filter(Boolean)
Severity: Minor
Found in lib/parse-base-url.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 log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  log (type, message) {
    if (type === 'debug') {
      if (this.options.debug === true) {
        message = `${new Date().toUTCString()} [debug] | ${message}`
        console.log(message)
Severity: Minor
Found in lib/argv.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 initAws has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const initAws = (options) => {
  AWS.config.update({
    accessKeyId: options.s3AccessKeyId,
    secretAccessKey: options.s3SecretAccessKey,
    sslEnabled: options.s3SSLEnabled,
Severity: Minor
Found in lib/init-aws.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

Avoid too many return statements within this function.
Open

            return callback(err, hits)
Severity: Major
Found in lib/transports/__es__/_helpers.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                  return scrollResultSet(self, callback)
    Severity: Major
    Found in lib/transports/__es__/_helpers.js - About 30 mins to fix

      Function anonymize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function anonymize (thing, options = {}) {
        if (
          thing === null ||
          thing instanceof Date
        ) {
      Severity: Minor
      Found in transforms/anonymize.js - About 25 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 _reviver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const _reviver = (bigIntFields = {}) => (key, value) => {
        if (!_.isEmpty(bigIntFields) && !bigIntFields[key]) {
          return value
        }
        if (value && value.isLosslessNumber) {
      Severity: Minor
      Found in lib/jsonparser.js - About 25 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 _replacer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const _replacer = (bigIntFields = {}) => (key, value) => {
        if (!_.isEmpty(bigIntFields) && !bigIntFields[key]) {
          return value
        }
      
      
      Severity: Minor
      Found in lib/jsonparser.js - About 25 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