autotelik/datashift

View on GitHub

Showing 67 of 255 total issues

Method activate_sheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def activate_sheet(term)

      if @workbook
        x = term.is_a?(String) ? @workbook.getSheetIndex(term.to_java(java.lang.String)) : term
        @sheet = worksheet(x)
Severity: Minor
Found in lib/datashift/applications/jexcel_file.rb - 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

Method process_missing_records has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def process_missing_records( missing_records )
      unless missing_records.empty?
        FileUtils.mkdir_p('MissingAttachmentRecords') unless File.directory?('MissingAttachmentRecords')

        puts "WARNING : #{missing_records.size} of #{loading_files_cache.size} files could not be attached to a #{load_object_class}"
Severity: Minor
Found in lib/datashift/loaders/paperclip/attachment_loader.rb - 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

Method active_worksheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def active_worksheet(term = nil)
      if @workbook
        if term.nil?
          @sheet ||= @workbook.getSheetAt(@current_sheet_index)
        else
Severity: Minor
Found in lib/datashift/applications/jexcel_file_extensions.rb - 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

Method record_to_column has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def record_to_column(record, json = false)

      return '' if record.nil? || (record.respond_to?(:each) && record.empty?)

      # :only and :except options can be used to limit the attributes included
Severity: Minor
Found in lib/datashift/column_packer.rb - 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

Method parse_headers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_headers( sheet, header_row_idx = 0 )

      headers = DataShift::Headers.new(:excel, header_row_idx)

      header_row = sheet.row(header_row_idx)
Severity: Minor
Found in lib/datashift/excel_base.rb - 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

Method method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing(method, *args, &block)
      # puts @excel.class, method, args.inspect

      if @excel.respond_to?(method)
        @excel.send(method, *args, &block)
Severity: Minor
Found in lib/datashift/applications/excel.rb - About 45 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

Method create_worksheet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def create_worksheet( options = {} )
      sheet_name = options[:name]

      @workbook = HSSFWorkbook.new if @workbook.nil?

Severity: Minor
Found in lib/datashift/applications/jexcel_file.rb - About 45 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

Method create_paperclip_attachment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def create_paperclip_attachment(klass, attachment_path, options = {})

      has_attached_file_attribute = options[:has_attached_file_name] ? options[:has_attached_file_name].to_sym : :attachment

      attachment_file = get_file(attachment_path)
Severity: Minor
Found in lib/datashift/loaders/paperclip/datashift_paperclip.rb - About 45 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

Method create_attachment has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def create_attachment(klass, attachment_path, record = nil, attach_to_record_field = nil, options = {})
Severity: Minor
Found in lib/datashift/loaders/paperclip/image_loading.rb - About 35 mins to fix

    Method file_set_field has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def file_set_field( file_name, field, old_value, new_value, regex = nil )
    Severity: Minor
    Found in lib/datashift/file_definitions.rb - About 35 mins to fix

      Method get_record_by! has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def get_record_by!(klazz, field, search_terms, split_on = ' ', options = {} )
      Severity: Minor
      Found in lib/datashift/querying.rb - About 35 mins to fix

        Method get_record_by has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_record_by(klazz, field, search_term, split_on = ' ', options = {})
        Severity: Minor
        Found in lib/datashift/querying.rb - About 35 mins to fix

          Method add_comment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_comment( cell, text )
                raise 'Please supply valid HSSFCell' unless cell.respond_to?('setCellComment')
                return if @sheet.nil?
          
                patriarch = @patriarchs[@sheet.getSheetName]
          Severity: Minor
          Found in lib/datashift/applications/jexcel_file_extensions.rb - 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

          Method autosize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def autosize(column = nil)
                return if @sheet.nil?
                if column.is_a? Integer
                  @sheet.autoSizeColumn(column)
                else
          Severity: Minor
          Found in lib/datashift/applications/jexcel_file_extensions.rb - 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

          Method bind_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def bind_headers( headers )
          
                logger.info("Binding #{headers.size} inbound headers to #{load_object_class.name}")
          
                begin
          Severity: Minor
          Found in lib/datashift/loaders/loader_base.rb - 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 method.
          Open

                when HSSFCell::CELL_TYPE_BLANK    then return ''
          Severity: Major
          Found in lib/datashift/applications/ruby_poi_translations.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  when HSSFCell::CELL_TYPE_BOOLEAN  then return cell.getBooleanCellValue
            Severity: Major
            Found in lib/datashift/applications/ruby_poi_translations.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    when HSSFCell::CELL_TYPE_ERROR    then return cell.getErrorCellValue
              Severity: Major
              Found in lib/datashift/applications/ruby_poi_translations.rb - About 30 mins to fix

                Method export_with_associations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def export_with_associations(file_name, klass, records, options = {})
                
                      state = DataShift::Configuration.call.with
                
                      DataShift::Configuration.call.with = :all
                Severity: Minor
                Found in lib/datashift/exporters/csv_exporter.rb - 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

                Method export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def export(file, export_records, options = {})
                      records = [*export_records]
                
                      if records.blank?
                        logger.warn('Excel Export - No objects supplied for export - no file written')
                Severity: Minor
                Found in lib/datashift/exporters/excel_exporter.rb - 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