autotelik/datashift

View on GitHub
lib/datashift/applications/jexcel_file.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class JExcelFile has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class JExcelFile

    include RubyPoiTranslations
    extend RubyPoiTranslations

Severity: Minor
Found in lib/datashift/applications/jexcel_file.rb - About 2 hrs to fix

    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 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 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

    TODO found
    Open

        # Currently ignores skip argument - TODO - this is how spreadsheet gem works

    Replace class var @@maxrows with a class instance var.
    Open

        @@maxrows = 65535

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    There are no issues that match your filters.

    Category
    Status