jonas-lantto/table_transform

View on GitHub

Showing 6 of 6 total issues

Class Table has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Table
    attr_reader :formulas
    attr_reader :table_properties
    attr_reader :column_properties

Severity: Minor
Found in lib/table_transform/table.rb - About 2 hrs to fix

    Method validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate(properties)
            super
            properties.each { |k, v|
              case k
                when :name
    Severity: Minor
    Found in lib/table_transform/table.rb - About 1 hr 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate(properties)
            super
            properties.each { |k, v|
              case k
                when :format
    Severity: Minor
    Found in lib/table_transform/table.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 + has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def +(table)
          t2 = table.to_a
          t2_header = t2.shift
          raise 'Tables cannot be added due to header mismatch' unless @column_properties.keys == t2_header
          raise 'Tables cannot be added due to column properties mismatch' unless column_properties_eql? table.column_properties
    Severity: Minor
    Found in lib/table_transform/table.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 rename_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rename_column(from, to)
          validate_column_exist(from)
          validate_column_absence(to)
    
          @column_properties = @column_properties.map{|k,v| [k == from ? to : k, v] }.to_h
    Severity: Minor
    Found in lib/table_transform/table.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 create_column_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_column_metadata(column_properties, formats, formulas)
          res = []
          column_properties.each{ |header_name, data|
            col_props = TableTransform::Properties.new data.to_h
    
    
    Severity: Minor
    Found in lib/table_transform/excel_creator.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