mailcannon/mailcannon

View on GitHub

Showing 4 of 4 total issues

Method deep_merge! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def deep_merge!(other_hash, &block)
      other_hash.each_pair do |k,v|
        tv = self[k]
        if tv.is_a?(Hash) && v.is_a?(Hash)
          self[k] = tv.deep_merge(v, &block)
Severity: Minor
Found in lib/mailcannon/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 validate_xsmtpapi! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_xsmtpapi!
    return true
    if self.to.size>1
      if xsmtpapi['sub']
        xsmtpapi['sub'].each do |sub|
Severity: Minor
Found in lib/mailcannon/adapters/sendgrid_web.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 post_envelope! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def post_envelope!(options = {})
    self.save if self.changed?
    raise "Envelope(#{self.id}) has no mail! Didn't you already send it?" unless self.mail
    if validate_xsmtpapi(self.xsmtpapi)
      jid = schedule_send_job(options[:queue])
Severity: Minor
Found in lib/mailcannon/envelope.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 send! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def send!
      begin
        validate_envelope!
        response = send_multiple_emails
        success = successfully_sent?(response)
Severity: Minor
Found in lib/mailcannon/adapters/sendgrid_web.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