initiatived21/d21

View on GitHub
app/mailers/initiator_mailer.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [11/10]
Open

  def send_to_initiator_or_only_admin &block
    mailing_options = { subject: t('.subject') }
    initiator = @pledge.initiator
    if (initiator.mailings_enabled)
      mailing_options[:to] = initiator.email
Severity: Minor
Found in app/mailers/initiator_mailer.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Don't use parentheses around a method call.
Open

    if (initiator.mailings_enabled)
Severity: Minor
Found in app/mailers/initiator_mailer.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used. You can also write as send_to_initiator_or_only_admin(*) if you want the method to accept any arguments but don't care about them.
Open

  def send_to_initiator_or_only_admin &block
Severity: Minor
Found in app/mailers/initiator_mailer.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Don't use parentheses around the condition of an if.
Open

    if (initiator.mailings_enabled)
Severity: Minor
Found in app/mailers/initiator_mailer.rb by rubocop

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Missing magic comment # frozen_string_literal: true.
Open

# Contains mailings to the initiator of a pledge about the same.
Severity: Minor
Found in app/mailers/initiator_mailer.rb by rubocop

This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: when_needed (default)

# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
  # ...
end

# good
# frozen_string_literal: true

module Foo
  # ...
end

Example: EnforcedStyle: always

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

There are no issues that match your filters.

Category
Status