taskrabbit/elasticsearch-dump

View on GitHub

Showing 48 of 77 total issues

Function setAliases has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  setAliases (data, limit, offset, callback) {
    if (this.haveSetAliases === true || data.length === 0) {
      return callback(null, 0)
    }

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

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

      Function setupGet has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async setupGet (offset) {
          this.bufferedData = []
          this.stream = parse(this._csvConfigs || {
            headers: this._headers,
            delimiter: this.parent.options.csvDelimiter,
      Severity: Minor
      Found in lib/transports/csv.js - About 1 hr to fix

        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

                                  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

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    if (parentIndex > -1) {
                                                      sortedMappings.splice(parentIndex, 0, { key, index, data: mappings[key] })
                                                    } else {
                                                      const childIndex = sortedMappings.findIndex(set => (set.data._parent) && (set.data._parent.type === key)) // find child
                                                      if (childIndex > -1) {
                                    Severity: Major
                                    Found in lib/transports/__es__/_mapping.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language