emancu/toml-rb

View on GitHub

Showing 3 of 3 total issues

Method navigate_keys has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def navigate_keys(hash, symbolize_keys = false)
      current = hash
      keys = symbolize_keys ? @dotted_keys.map(&:to_sym) : @dotted_keys
      last_key = keys.pop

Severity: Minor
Found in lib/toml-rb/table_array.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 navigate_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def navigate_keys(hash, visited_keys, symbolize_keys = false)
      ensure_key_not_defined(visited_keys)
      current = hash
      keys = symbolize_keys ? @dotted_keys.map(&:to_sym) : @dotted_keys
      keys.each do |key|
Severity: Minor
Found in lib/toml-rb/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 to_toml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_toml(obj)
      if obj.is_a?(Time) || obj.is_a?(DateTime)
        obj.strftime("%Y-%m-%dT%H:%M:%SZ")
      elsif obj.is_a?(Date)
        obj.strftime("%Y-%m-%d")
Severity: Minor
Found in lib/toml-rb/dumper.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

Severity
Category
Status
Source
Language