initiatived21/d21

View on GitHub
app/lib/mail_delivery.rb

Summary

Maintainability
A
35 mins
Test Coverage

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

  def self.to_one mailer_class, mailing_name, recipient, time, *mailing_args
Severity: Minor
Found in app/lib/mail_delivery.rb - About 35 mins to fix

    private (on line 29) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

      def self.delivery_timing_for recipient
    Severity: Minor
    Found in app/lib/mail_delivery.rb by rubocop

    This cop checks for private or protected access modifiers which are applied to a singleton method. These access modifiers do not make singleton methods private/protected. private_class_method can be used for that.

    Example:

    # bad
    
    class C
      private
    
      def self.method
        puts 'hi'
      end
    end

    Example:

    # good
    
    class C
      def self.method
        puts 'hi'
      end
    
      private_class_method :method
    end

    Example:

    # good
    
    class C
      class << self
        private
    
        def method
          puts 'hi'
        end
      end
    end

    Useless private access modifier.
    Open

      private
    Severity: Minor
    Found in app/lib/mail_delivery.rb by rubocop

    This cop checks for redundant access modifiers, including those with no code, those which are repeated, and leading public modifiers in a class or module body. Conditionally-defined methods are considered as always being defined, and thus access modifiers guarding such methods are not redundant.

    Example:

    class Foo
      public # this is redundant (default access is public)
    
      def method
      end
    
      private # this is not redundant (a method is defined)
      def method2
      end
    
      private # this is redundant (no following methods are defined)
    end

    Example:

    class Foo
      # The following is not redundant (conditionally defined methods are
      # considered as always defining a method)
      private
    
      if condition?
        def method
        end
      end
    
      protected # this is not redundant (method is defined)
    
      define_method(:method2) do
      end
    
      protected # this is redundant (repeated from previous modifier)
    
      [1,2,3].each do |i|
        define_method("foo#{i}") do
        end
      end
    
      # The following is redundant (methods defined on the class'
      # singleton class are not affected by the public modifier)
      public
    
      def self.method3
      end
    end

    Example:

    # Lint/UselessAccessModifier:
    #   ContextCreatingMethods:
    #     - concerning
    require 'active_support/concern'
    class Foo
      concerning :Bar do
        def some_public_method
        end
    
        private
    
        def some_private_method
        end
      end
    
      # this is not redundant because `concerning` created its own context
      private
    
      def some_other_private_method
      end
    end

    Example:

    # Lint/UselessAccessModifier:
    #   MethodCreatingMethods:
    #     - delegate
    require 'active_support/core_ext/module/delegation'
    class Foo
      # this is not redundant because `delegate` creates methods
      private
    
      delegate :method_a, to: :method_b
    end

    private (on line 29) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

      def self.to_one mailer_class, mailing_name, recipient, time, *mailing_args
    Severity: Minor
    Found in app/lib/mail_delivery.rb by rubocop

    This cop checks for private or protected access modifiers which are applied to a singleton method. These access modifiers do not make singleton methods private/protected. private_class_method can be used for that.

    Example:

    # bad
    
    class C
      private
    
      def self.method
        puts 'hi'
      end
    end

    Example:

    # good
    
    class C
      def self.method
        puts 'hi'
      end
    
      private_class_method :method
    end

    Example:

    # good
    
    class C
      class << self
        private
    
        def method
          puts 'hi'
        end
      end
    end

    Missing magic comment # frozen_string_literal: true.
    Open

    module MailDelivery
    Severity: Minor
    Found in app/lib/mail_delivery.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