solnic/transproc

View on GitHub

Showing 4 of 4 total issues

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

    def self.eval_values(hash, args, filters = [])
      hash.each_with_object({}) do |(key, value), output|
        output[key] =
          case value
          when Proc
Severity: Minor
Found in lib/transproc/hash.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 unwrap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.unwrap(source_hash, root, selected = nil, prefix: false)
      return source_hash unless source_hash[root]

      add_prefix = ->(key) do
        combined = [root, key].join('_')
Severity: Minor
Found in lib/transproc/hash.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 deep_symbolize_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.deep_symbolize_keys(hash)
      hash.each_with_object({}) do |(key, value), output|
        output[key.to_sym] =
          case value
          when Hash
Severity: Minor
Found in lib/transproc/hash.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 fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def fetch(fn)
      return fn unless fn.instance_of? Symbol
      respond_to?(fn) ? method(fn) : store.fetch(fn)
    rescue
      raise FunctionNotFoundError.new(fn, self)
Severity: Minor
Found in lib/transproc/registry.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