smartinez87/exception_notification

View on GitHub
lib/exception_notifier/email_notifier.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method extended has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.extended(base)
        base.class_eval do
          send(:include, ExceptionNotifier::BacktraceCleaner)

          # Append application view path to the ExceptionNotifier lookup context.
Severity: Major
Found in lib/exception_notifier/email_notifier.rb - About 3 hrs to fix

    Method compose_subject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

              def compose_subject
                subject = @options[:email_prefix].to_s.dup
                subject << "(#{@options[:accumulated_errors_count]} times)" if @options[:accumulated_errors_count].to_i > 1
                subject << "#{@kontroller.controller_name}##{@kontroller.action_name}" if include_controller?
                subject << " (#{@exception.class})"
    Severity: Minor
    Found in lib/exception_notifier/email_notifier.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 compose_email has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

              def compose_email
                set_data_variables
                subject = compose_subject
                name = @env.nil? ? 'background_exception_notification' : 'exception_notification'
                exception_recipients = maybe_call(@options[:exception_recipients])
    Severity: Minor
    Found in lib/exception_notifier/email_notifier.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 exception_notification has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

              def exception_notification(env, exception, options = {}, default_options = {})
                load_custom_views
    
                @env        = env
                @exception  = exception
    Severity: Minor
    Found in lib/exception_notifier/email_notifier.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 load_custom_views has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

              def load_custom_views
                return unless defined?(Rails) && Rails.respond_to?(:root)
    
                prepend_view_path Rails.root.nil? ? 'app/views' : "#{Rails.root}/app/views"
              end
    Severity: Minor
    Found in lib/exception_notifier/email_notifier.rb - About 35 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