autotelik/datashift

View on GitHub

Showing 67 of 255 total issues

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

      def self.get_loader(file_name)

        raise DataShift::BadFile, "Cannot load #{file_name} file not found." unless File.exist?(file_name)

        ext = File.extname(file_name)
Severity: Minor
Found in lib/datashift/loaders/loader_factory.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

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

    def assignment(record, value, model_method)

      operator = model_method.operator
      connection_adapter_column = model_method.connection_adapter_column

Severity: Minor
Found in lib/datashift/populators/populator.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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def write( file_name = nil )
      file = file_name.nil? ? @filepath : file_name
      out = FileOutputStream.new(file)
      @workbook.write(out) unless @workbook.nil?
      out.close
Severity: Minor
Found in lib/datashift/applications/jexcel_file.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 worksheet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def worksheet( index )
      if @workbook
        x = index.is_a?(String) ? @workbook.getSheetIndex(index.to_java(java.lang.String)) : index
        return @workbook.getSheetAt(x)
      end
Severity: Minor
Found in lib/datashift/applications/jexcel_file.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 open_excel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def open_excel( file_name, options = {})

      @excel = DataShift::Excel.new

      @excel.open(file_name)
Severity: Minor
Found in lib/datashift/excel_base.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_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

Severity
Category
Status
Source
Language