artsy/garner

View on GitHub

Showing 3 of 3 total issues

Method apply has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

          def self.apply(identity, ruby_context = nil)
            value = nil

            if ruby_context.send(:caller)
              ruby_context.send(:caller).compact.each do |line|
Severity: Minor
Found in lib/garner/strategies/context/key/caller.rb - About 4 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 apply has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def self.apply(binding)
            binding = binding.proxy_binding if binding.respond_to?(:proxy_binding)

            return unless binding.respond_to?(:cache_key) && binding.cache_key
            return unless binding.respond_to?(:updated_at) && binding.updated_at
Severity: Minor
Found in lib/garner/strategies/binding/key/safe_cache_key.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 default_root has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def self.default_root
            if defined?(::Rails) && ::Rails.respond_to?(:root)
              ::Rails.root.realpath.to_s
            else
              # Try to use the nearest ancestor directory containing a Gemfile.
Severity: Minor
Found in lib/garner/strategies/context/key/caller.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