taskrabbit/elasticsearch-dump

View on GitHub

Showing 48 of 77 total issues

Function scrollResultSet has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const scrollResultSet = (self, callback, loadedHits, response) => {
  let body

  if (loadedHits && loadedHits.length > 0) {
    // are we skipping and we have hits?
Severity: Major
Found in lib/transports/__es__/_helpers.js - About 4 hrs to fix

    Function aws4signer has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    const aws4signer = async (esRequest, parent) => {
      // Consider deprecating - insecure to use on command line and credentials can be found by default at ~/.aws/credentials or as environment variables
      const useAwsCredentials = ((typeof parent.options.awsAccessKeyId === 'string') && (typeof parent.options.awsSecretAccessKey === 'string'))
      // Consider deprecating - can be achieved with awsChain and setting AWS_PROFILE and AWS_CONFIG_FILE environment variables as needed
      const useAwsProfile = (typeof parent.options.awsIniFileProfile === 'string')
    Severity: Minor
    Found in lib/aws4signer.js - About 3 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 setAnalyzer has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setAnalyzer (data, limit, offset, callback) {
        const updateAnalyzer = (err, response) => {
          if (err) { return callback(err) }
    
          try {
    Severity: Major
    Found in lib/transports/__es__/_analyzer.js - About 3 hrs to fix

      Function parse has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

        parse (argv, defaults, parseJSONOpts = false) {
          // parse passed options & use defaults otherwise
          for (const i in defaults) {
            this.options[i] = argv[i] || defaults[i]
      
      
      Severity: Minor
      Found in lib/argv.js - About 3 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 setMapping has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        setMapping (data, limit, offset, callback) {
          if (this.haveSetMapping === true || data.length === 0) {
            callback(null, 0)
          } else {
            const esRequest = {
      Severity: Major
      Found in lib/transports/__es__/_mapping.js - About 3 hrs to fix

        Function setData has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          setData (data, limit, offset, callback) {
            if (data.length === 0) { return callback(null, 0) }
        
            let writes = 0
        
        
        Severity: Major
        Found in lib/transports/__es__/_data.js - About 2 hrs to fix

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

            setAnalyzer (data, limit, offset, callback) {
              const updateAnalyzer = (err, response) => {
                if (err) { return callback(err) }
          
                try {
          Severity: Minor
          Found in lib/transports/__es__/_analyzer.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 scrollResultSet has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          const scrollResultSet = (self, callback, loadedHits, response) => {
            let body
          
            if (loadedHits && loadedHits.length > 0) {
              // are we skipping and we have hits?
          Severity: Minor
          Found in lib/transports/__es__/_helpers.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 set has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            set (data, limit, offset, callback) {
              const error = null
              let lineCounter = 0
          
              if (!this.stream) {
          Severity: Minor
          Found in lib/transports/file.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 updateAnalyzer has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const updateAnalyzer = (err, response) => {
                if (err) { return callback(err) }
          
                try {
                  data = jsonParser.parse(data[0])
          Severity: Major
          Found in lib/transports/__es__/_analyzer.js - About 2 hrs to fix

            Function anonymize has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function anonymize (thing, options = {}) {
              if (
                thing === null ||
                thing instanceof Date
              ) {
            Severity: Major
            Found in transforms/anonymize.js - About 2 hrs to fix

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

                async getData (limit, offset, callback) {
                  let searchRequest, uri
                  let searchBodyTmp
              
                  if (this.parent.options.searchWithTemplate) {
              Severity: Major
              Found in lib/transports/__es__/_data.js - About 2 hrs to fix

                Function getData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  async getData (limit, offset, callback) {
                    let searchRequest, uri
                    let searchBodyTmp
                
                    if (this.parent.options.searchWithTemplate) {
                Severity: Minor
                Found in lib/transports/__es__/_data.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 set has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  set (data, limit, offset, callback) {
                    const error = null
                    let lineCounter = 0
                
                    if (!this._reading) {
                Severity: Minor
                Found in lib/transports/s3.js - About 1 hr to fix

                  Function aws4signer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const aws4signer = async (esRequest, parent) => {
                    // Consider deprecating - insecure to use on command line and credentials can be found by default at ~/.aws/credentials or as environment variables
                    const useAwsCredentials = ((typeof parent.options.awsAccessKeyId === 'string') && (typeof parent.options.awsSecretAccessKey === 'string'))
                    // Consider deprecating - can be achieved with awsChain and setting AWS_PROFILE and AWS_CONFIG_FILE environment variables as needed
                    const useAwsProfile = (typeof parent.options.awsIniFileProfile === 'string')
                  Severity: Minor
                  Found in lib/aws4signer.js - About 1 hr to fix

                    Function constructor has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      constructor (parent, url, options) {
                        super()
                        this.base = parseBaseURL(url, options)
                        this.options = options
                        this.parent = parent
                    Severity: Minor
                    Found in lib/transports/elasticsearch.js - About 1 hr to fix

                      Function set has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                        set (data, limit, offset, callback) {
                          const error = null
                          let lineCounter = 0
                      
                          if (!this.stream) {
                      Severity: Minor
                      Found in lib/transports/csv.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 getIo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const getIo = (elasticdump, type) => {
                        let EntryProto
                        if (elasticdump.options[type] && !elasticdump.options[`${type}Transport`]) {
                          if (isUrl(elasticdump.options[type])) {
                            elasticdump[`${type}Type`] = 'elasticsearch'
                      Severity: Minor
                      Found in lib/ioHelper.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 set has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                        set (data, limit, offset, callback) {
                          const error = null
                          let lineCounter = 0
                      
                          if (!this._reading) {
                      Severity: Minor
                      Found in lib/transports/s3.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 __looper has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async __looper (limit, offset, totalWrites, queue) {
                          const ignoreErrors = this.options['ignore-errors'] === true
                      
                          return new Promise((resolve, reject) => {
                            this.input.get(limit, offset, (err, data) => {
                      Severity: Minor
                      Found in lib/processor.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language