crewmate/crewmate

View on GitHub
app/models/emailer/incoming.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method process_incoming has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def process_incoming(email)
    raise MissingInfo, "Invalid mail body" if email.body.blank?

    from = Array(email.from).first
    raise MissingInfo, "Invalid From field" if from.nil?
Severity: Minor
Found in app/models/emailer/incoming.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 get_target has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_target(email)
    # projectname+targetclass+id@mailserver.com
    permalink, klass, object_id = @to.split('+')

    begin
Severity: Minor
Found in app/models/emailer/incoming.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 receive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def receive(email)
    email = ParamsMail.new(email) if Hash === email

    # TODO: ease a bit on the ivars pls
    process_incoming email
Severity: Minor
Found in app/models/emailer/incoming.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 get_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_action
    if @body =~ ACTION_MATCH
      tag = $1.downcase

      @target_action = case tag
Severity: Minor
Found in app/models/emailer/incoming.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 create_task has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_task
    raise "Subject and body cannot be blank when creating task from email" if @subject.blank? && @body.blank?
    Rails.logger.info "Creating task '#{@subject}'"

    task_list_name = "Inbox"
Severity: Minor
Found in app/models/emailer/incoming.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

There are no issues that match your filters.

Category
Status