app/mailers/user_notifier.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class has too many lines. [194/100]
Open

class UserNotifier < ActionMailer::Base
  default from: SystemSetting.notifier_email.to_s

  # kludge for A_S and rails 2.0
  def generic_view_paths
Severity: Minor
Found in app/mailers/user_notifier.rb by rubocop

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

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

  def basket_notification_to(recipient, sender, basket, type)
    setup_email(recipient)
    @sender = sender
    @basket = basket

Severity: Minor
Found in app/mailers/user_notifier.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.

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

  def join_notification_to(recipient, sender, basket, type)
    setup_email(recipient)
    @sender = sender
    @basket = basket

Severity: Minor
Found in app/mailers/user_notifier.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.

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

    define_method "private_#{type}" do |recipient, item, url|
      setup_email(recipient)
      item.private_version!
      basket = item.is_a?(Comment) ? item.commentable.basket : item.basket

Severity: Minor
Found in app/mailers/user_notifier.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.

Assignment Branch Condition size for basket_notification_to is too high. [21/15]
Open

  def basket_notification_to(recipient, sender, basket, type)
    setup_email(recipient)
    @sender = sender
    @basket = basket

Severity: Minor
Found in app/mailers/user_notifier.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for join_notification_to is too high. [19.52/15]
Open

  def join_notification_to(recipient, sender, basket, type)
    setup_email(recipient)
    @sender = sender
    @basket = basket

Severity: Minor
Found in app/mailers/user_notifier.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method basket_notification_to has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def basket_notification_to(recipient, sender, basket, type)
    setup_email(recipient)
    @sender = sender
    @basket = basket

Severity: Minor
Found in app/mailers/user_notifier.rb - About 1 hr to fix

    Method join_notification_to has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def join_notification_to(recipient, sender, basket, type)
        setup_email(recipient)
        @sender = sender
        @basket = basket
    
    
    Severity: Minor
    Found in app/mailers/user_notifier.rb - About 1 hr to fix

      Method item_flagged_for has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def item_flagged_for(moderator, url, flag, flagging_user, submitter, revision, message)
      Severity: Major
      Found in app/mailers/user_notifier.rb - About 50 mins to fix

        Method email_to has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def email_to(recipient, sender, subject, message, from_basket = nil)
        Severity: Minor
        Found in app/mailers/user_notifier.rb - About 35 mins to fix

          Avoid parameter lists longer than 5 parameters. [7/5]
          Open

            def item_flagged_for(moderator, url, flag, flagging_user, submitter, revision, message)
          Severity: Minor
          Found in app/mailers/user_notifier.rb by rubocop

          This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            def signup_notification(user)
              setup_email(user)
              @subject += I18n.t('user_notifier_model.activate_account')
              @url = "#{SystemSetting.site_url}site/account/activate/#{user.activation_code}"
          
          
          Severity: Minor
          Found in app/mailers/user_notifier.rb and 1 other location - About 15 mins to fix
          app/mailers/user_notifier.rb on lines 9..14

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 25.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            def forgot_password(user)
              setup_email(user)
              @subject += I18n.t('user_notifier_model.password_change')
              @url = "#{SystemSetting.site_url}site/account/reset_password/#{user.password_reset_code}"
          
          
          Severity: Minor
          Found in app/mailers/user_notifier.rb and 1 other location - About 15 mins to fix
          app/mailers/user_notifier.rb on lines 24..29

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 25.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Use the return of the conditional for variable assignment and comparison.
          Open

                if item.respond_to?(:short_summary) && basket.setting(:private_item_notification_show_short_summary) == true
                  @summary = item.short_summary
                else
                  @summary = nil
                end
          Severity: Minor
          Found in app/mailers/user_notifier.rb by rubocop

          There are no issues that match your filters.

          Category
          Status