AlexWayfer/gorilla_patch

View on GitHub

Showing 5 of 5 total issues

Method module_parent_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

            def module_parent_name
                if defined?(@module_parent_name)
                    @module_parent_name
                else
                    module_parent_name = name =~ /::[^:]+\Z/ ? Regexp.last_match.pre_match : nil
Severity: Minor
Found in lib/gorilla_patch/module_parent.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 nilify_blank_strings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

                def nilify_blank_strings
                    result = map do |element|
                        if element.is_a?(String) && element.blank?
                            nil
                        elsif REFINED_ENUMERABLES.any? { |klass| element.is_a?(klass) }
Severity: Minor
Found in lib/gorilla_patch/blank.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 slice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

            def slice(*keys, nils: false)
                return super if defined?(super) && !nils

                keys.each_with_object(self.class.new) do |k, hash|
                    hash[k] = self[k] if nils || key?(k)
Severity: Minor
Found in lib/gorilla_patch/slice.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 symbolize_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def symbolize_keys(deep: false)
                each_with_object({}) do |(key, value), hash|
                    value = deep_symbolize_keys_in(value) if deep
                    key = key.to_sym if key.respond_to?(:to_sym)
                    hash[key] = value
Severity: Minor
Found in lib/gorilla_patch/symbolize.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 deep_value_merge! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def deep_value_merge!(other_key, self_value, other_value, &block)
                self[other_key] =
                    if self_value.is_a?(Hash) && other_value.is_a?(Hash)
                        self_value.deep_merge!(other_value, &block)
                    elsif block && key?(other_key)
Severity: Minor
Found in lib/gorilla_patch/deep_merge.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