pboling/sanitize_email

View on GitHub

Showing 3 of 8 total issues

Method address_list_filter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def address_list_filter(list_type, address)
      # TODO: How does this handle email addresses with user names like "Foo Example <foo@example.org>"
      has_address = send(list_type).include?(address)
      case list_type
      when :good_list then
Severity: Minor
Found in lib/sanitize_email/overridden_addresses.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 override_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def override_email(type, actual_addresses)
      # Normalized to an arrays
      # puts "override_email 1: #{type} - #{actual_addresses}"
      real_addresses = Array(actual_addresses)

Severity: Minor
Found in lib/sanitize_email/overridden_addresses.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 sanitize_engaged? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.sanitize_engaged?(message)
      # Don't sanitize the message if it will not be delivered
      return false unless message.perform_deliveries

      # Has it been forced via the force_sanitize mattr?
Severity: Minor
Found in lib/sanitize_email/bleach.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