taskrabbit/elasticsearch-dump

View on GitHub

Showing 77 of 77 total issues

Function get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  get (limit, offset, callback) {
    const type = this.parent.options.type
    this.version('input', err => {
      if (err) { return callback(err) }

Severity: Minor
Found in lib/transports/elasticsearch.js - About 1 hr to fix

    Function setTemplates has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setTemplates (data, limit, offset, callback) {
        if (this.haveSetTemplates === true || data.length === 0) {
          return callback(null, 0)
        }
    
    
    Severity: Minor
    Found in lib/transports/__es__/_template.js - About 1 hr to fix

      Function set has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        set (data, limit, offset, callback) {
          const type = this.parent.options.type
          this.version('output', err => {
            if (err) { return callback(err) }
      
      
      Severity: Minor
      Found in lib/transports/elasticsearch.js - About 1 hr to fix

        Function version has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          version (prefix, callback) {
            if (this.ESversion) { return callback() }
            const esRequest = {
              url: `${this.base.host}/`,
              method: 'GET'
        Severity: Minor
        Found in lib/transports/__es__/_base.js - About 1 hr to fix

          Function setSettings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            setSettings (data, limit, offset, callback) {
              if (this.haveSetSettings === true || data.length === 0) {
                return callback(null, 0)
              }
          
          
          Severity: Minor
          Found in lib/transports/__es__/_setting.js - About 1 hr to fix

            Function set has 35 lines of code (exceeds 25 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 1 hr to fix

              Function getIo has 33 lines of code (exceeds 25 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

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

                  getTemplates (limit, offset, callback) {
                    if (this.gotTemplates === true) {
                      callback(null, [])
                    } else {
                      const esRequest = {
                Severity: Minor
                Found in lib/transports/__es__/_template.js - About 1 hr to fix

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

                    constructor (input, output, options) {
                      super()
                      if (arguments.length === 1 && _.isPlainObject(arguments[0])) {
                        options = input
                        output = options.output
                  Severity: Minor
                  Found in elasticdump.js - About 1 hr to fix

                    Function setPolicies has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      setPolicies (data, limit, offset, callback) {
                        if (this.haveSetPolicies === true || data.length === 0) {
                          return callback(null, 0)
                        }
                    
                    
                    Severity: Minor
                    Found in lib/transports/__es__/_policy.js - About 1 hr to fix

                      Function set has 30 lines of code (exceeds 25 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

                        Function setScripts has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          setScripts (data, limit, offset, callback) {
                            if (this.haveSetScripts === true || data.length === 0) {
                              return callback(null, 0)
                            }
                        
                        
                        Severity: Minor
                        Found in lib/transports/__es__/_script.js - About 1 hr to fix

                          Function del has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            del (elem, callback) {
                              let thisUrl = `${this.base.host}/${encodeURIComponent(elem._index)}/${encodeURIComponent(elem._type || '_doc')}/${encodeURIComponent(elem._id)}`
                          
                              if (this.parent.options['delete-with-routing']) {
                                const obj = {}
                          Severity: Minor
                          Found in lib/transports/__es__/_data.js - About 1 hr to fix

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

                                if (!this.openStream) {
                                  this.currentOutStream = this._outStreamCreate(this.partitionNum)
                                  this.partitionNum++
                                  this.openStream = true
                                }
                            Severity: Major
                            Found in lib/splitters/csvStreamSplitter.js and 1 other location - About 1 hr to fix
                            lib/splitters/streamSplitter.js on lines 54..58

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 56.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                                if (!this.openStream) {
                                  this.currentOutStream = this._outStreamCreate(this.partitionNum)
                                  this.partitionNum++
                                  this.openStream = true
                                }
                            Severity: Major
                            Found in lib/splitters/streamSplitter.js and 1 other location - About 1 hr to fix
                            lib/splitters/csvStreamSplitter.js on lines 38..42

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 56.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Function parseBaseURL has 26 lines of code (exceeds 25 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 1 hr to fix

                              Function dump has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                dump (callback, continuing, limit, offset, totalWrites) {
                                  if (this.validationErrors.length > 0) {
                                    this.emit('error', { errors: this.validationErrors })
                                    callback(new Error('There was an error starting this dump'))
                                    return
                              Severity: Minor
                              Found in elasticdump.js - About 55 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 constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                constructor (input, output, options) {
                                  super()
                                  if (arguments.length === 1 && _.isPlainObject(arguments[0])) {
                                    options = input
                                    output = options.output
                              Severity: Minor
                              Found in elasticdump.js - About 55 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

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

                                    const esRequest = {
                                      url: `${this.base.host}/_cluster/state/metadata?filter_path=**.stored_scripts.${this.base.index || '*'}`,
                                      method: 'GET'
                                    }
                              Severity: Minor
                              Found in lib/transports/__es__/_script.js and 1 other location - About 50 mins to fix
                              lib/transports/__es__/_policy.js on lines 10..13

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 51.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

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

                                    const esRequest = {
                                      url: `${this.base.host}/_ilm/policy/${this.base.index || ''}`,
                                      method: 'GET'
                                    }
                              Severity: Minor
                              Found in lib/transports/__es__/_policy.js and 1 other location - About 50 mins to fix
                              lib/transports/__es__/_script.js on lines 32..35

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 51.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Severity
                              Category
                              Status
                              Source
                              Language