roo-rb/roo-google

View on GitHub

Showing 4 of 4 total issues

Class Google has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class Roo::Google < Roo::Base
  attr_accessor :date_format, :datetime_format, :time_format
  # returns an array of sheet names in the spreadsheet
  attr_reader :sheets
  DATE_FORMAT     = '%d/%m/%Y'.freeze
Severity: Minor
Found in lib/roo/google.rb - About 2 hrs to fix

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

      def determine_datatype(val, numval = nil)
        if val.nil? || val[0, 1] == '='
          ty  = :formula
          val = numeric?(numval) ? numval.to_f : numval
        else
    Severity: Minor
    Found in lib/roo/google.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 rows_and_cols_min_max has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def rows_and_cols_min_max(sheet_no)
        ws   = worksheets[sheet_no - 1]
        rows = []
        cols = []
        for row in 1..ws.num_rows
    Severity: Minor
    Found in lib/roo/google.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 read_cell_row has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_cell_row(sheet, ws, row, col)
        key                    = "#{row},#{col}"
        string_value           = ws.input_value(row, col) # item['inputvalue'] ||  item['inputValue']
        numeric_value          = ws[row, col] # item['numericvalue']  ||  item['numericValue']
        (value, value_type)    = determine_datatype(string_value, numeric_value)
    Severity: Minor
    Found in lib/roo/google.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