autotelik/datashift

View on GitHub

Showing 67 of 255 total issues

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 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 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 get_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.get_files(path, options = {})
      return [path] if File.file?(path)
      glob = options[:glob] ? options[:glob] : '*.*'
      glob = options['recursive'] || options[:recursive] ? "**/#{glob}" : glob

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

    def poi_cell_type(data)

      if data.is_a?(Numeric)
        HSSFCell::CELL_TYPE_NUMERIC
      elsif data.nil?
Severity: Minor
Found in lib/datashift/applications/ruby_poi_translations.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