FinalCAD/csv2hash

View on GitHub

Showing 10 of 10 total issues

Method default! has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def default!
      cells.each do |cell|
        cell.rules.fetch(:position)
        default_position cell
        default_message cell
Severity: Minor
Found in lib/csv2hash/definition.rb - About 2 hrs 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 find_or_remove_dynamic_fields_on_mapping! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_remove_dynamic_fields_on_mapping!
      cells = definition.cells.dup
      # cells without optional and not found dynamic field
      definition.cells = [].tap do |_cells|
        while(!cells.empty?) do
Severity: Minor
Found in lib/csv2hash/validator.rb - About 2 hrs 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 find_or_remove_dynamic_fields_on_collection! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_remove_dynamic_fields_on_collection! y
      cells = definition.cells.dup
      # cells without optional and not found dynamic field
      definition.cells = [].tap do |_cells|
        while(!cells.empty?) do
Severity: Minor
Found in lib/csv2hash/validator.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_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_rules y=nil
      definition.type == Definition::MAPPING ? find_or_remove_dynamic_fields_on_mapping! : find_or_remove_dynamic_fields_on_collection!(y)
      definition.cells.each do |cell|
        _y, x = position cell.rules.fetch(:position)
        begin
Severity: Minor
Found in lib/csv2hash/validator.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 verify_valid_values! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_valid_values! cell, value
      values = cell.rules.fetch(:values)
      if values.class == Range
        raise unless values.include?(value.to_f)
      else
Severity: Minor
Found in lib/csv2hash/validator.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 fill_it has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def fill_it parsed_data, source_data
        definition.cells.each do |cell|
          if cell.rules.fetch :mappable
            x = cell.rules.fetch :position
            if (nested = cell.rules.fetch :nested)
Severity: Minor
Found in lib/csv2hash/parser/collection.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 default_position has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def default_position cell
      case type
      when MAPPING
        y, x = cell.rules.fetch(:position, ['undefined', 'undefined'])
        cell.rules.merge! key: "key_#{y}_#{x}" unless cell.rules.has_key? :key
Severity: Minor
Found in lib/csv2hash/definition.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 fill_it has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def fill_it parsed_data, source_data
        definition.cells.each do |cell|
          if cell.rules.fetch :mappable
            y, x = cell.rules.fetch :position
            if (nested = cell.rules.fetch :nested)
Severity: Minor
Found in lib/csv2hash/parser/mapping.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse
      load_data_source

      definition.validate!
      definition.default!
Severity: Minor
Found in lib/csv2hash.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 validate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate!
      unless TYPES.include?(@type)
        raise "not suitable type, please use '#{MAPPING}' or '#{COLLECTION}'"
      end
      raise 'cells must be an Array of cell' unless self.cells.class == Array
Severity: Minor
Found in lib/csv2hash/definition.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