fiedl/your_platform

View on GitHub
core_ext/mail/message.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method replace has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def replace(search, replace)
    if self.multipart?
      self.parts.each do |part|
        if part.text?
          part.body.raw_source.replace part.body.decoded.gsub(search, replace) if part.body.decoded.include? search
Severity: Minor
Found in core_ext/mail/message.rb - About 2 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 text has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def text
    if self.multipart?
      self.parts.each do |part|
        if part.text?
          return part.body.decoded
Severity: Minor
Found in core_ext/mail/message.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

Avoid deeply nested control flow statements.
Open

              part.body.raw_source.replace part.body.decoded.gsub(search, replace) if part.body.decoded.include? search
Severity: Major
Found in core_ext/mail/message.rb - About 45 mins to fix

    There are no issues that match your filters.

    Category
    Status