fbernier/tomlrb

View on GitHub

Showing 4 of 4 total issues

Method push_inline has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def push_inline(inline_arrays)
      merged_inline = {}

      inline_arrays.each do |inline_array|
        current = merged_inline
Severity: Minor
Found in lib/tomlrb/handler.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 set_context has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def set_context(identifiers, is_array_of_tables: false)
      if identifiers.empty?
        raise ParseError, 'Array needs a name'
      end

Severity: Minor
Found in lib/tomlrb/handler.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 deal_with_array_of_tables has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def deal_with_array_of_tables(identifiers, is_array_of_tables)
      stringified_identifier = identifiers.join('.')

      if is_array_of_tables
        @array_names << stringified_identifier
Severity: Minor
Found in lib/tomlrb/handler.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(year, month, day, hour, min, sec) # rubocop:disable Metrics/ParameterLists
Severity: Minor
Found in lib/tomlrb/local_date_time.rb - About 45 mins to fix
    Severity
    Category
    Status
    Source
    Language