dougyouch/mappable

View on GitHub

Showing 4 of 6 total issues

Method map_back_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.map_back_options(options)
      new_options = default_mapping_options(options[:dest], options[:src])
      [:if, :unless].each do |cond|
        next unless options[cond]

Severity: Minor
Found in lib/mappable/mapping.rb - About 45 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 skip? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def skip?(src_model, dest_model, options)
      return true if options[:if] && !call_method(self, options[:if])
      return true if options[:unless] && call_method(self, options[:unless])
      return true if options[:if_dest] && !call_method(dest_model, options[:if_dest])
      return true if options[:unless_dest] && call_method(dest_model, options[:unless_dest])
Severity: Minor
Found in lib/mappable/mapping.rb - About 45 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

Avoid too many return statements within this method.
Open

      return true if options[:if_src] && !call_method(src_model, options[:if_src])
Severity: Major
Found in lib/mappable/mapping.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return true if options[:unless_src] && call_method(src_model, options[:unless_src])
    Severity: Major
    Found in lib/mappable/mapping.rb - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language