pboling/exception_notification

View on GitHub
lib/exception_notification/notifiable_helper.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method verbose_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def verbose_output(exception, status_cd, file_path, send_email, send_web_hooks, request = nil, the_blamed = nil, rejected_sections = nil)
    puts("[EXCEPTION] #{exception}")
    puts("[EXCEPTION CLASS] #{exception.class}")
    puts("[EXCEPTION STATUS_CD] #{status_cd}")
    puts("[ERROR LAYOUT] #{self.class.error_layout}") if self.class.respond_to?(:error_layout)
Severity: Minor
Found in lib/exception_notification/notifiable_helper.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 perform_exception_notify_mailing has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def perform_exception_notify_mailing(exception, data, request = nil, the_blamed = nil, verbose = false, rejected_sections = nil)
    if ExceptionNotification::Notifier.config[:exception_recipients].blank?
      puts("[EMAIL NOTIFICATION] ExceptionNotification::Notifier.config[:exception_recipients] is blank, notification cancelled!") if verbose
    else
      class_name = self.respond_to?(:controller_name) ? self.controller_name : self.to_s
Severity: Minor
Found in lib/exception_notification/notifiable_helper.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 verbose_output has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def verbose_output(exception, status_cd, file_path, send_email, send_web_hooks, request = nil, the_blamed = nil, rejected_sections = nil)
Severity: Major
Found in lib/exception_notification/notifiable_helper.rb - About 1 hr to fix

    Method perform_exception_notify_mailing has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def perform_exception_notify_mailing(exception, data, request = nil, the_blamed = nil, verbose = false, rejected_sections = nil)
    Severity: Minor
    Found in lib/exception_notification/notifiable_helper.rb - About 45 mins to fix

      Method should_notify_on_exception? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def should_notify_on_exception?(exception, status_cd = nil, verbose = false)
          # don't notify (email or web hooks) on exceptions raised locally
          verbose && ExceptionNotification::Notifier.config[:skip_local_notification] && is_local? ?
            puts("[NOTIFY LOCALLY] NO") :
            nil
      Severity: Minor
      Found in lib/exception_notification/notifiable_helper.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

      Avoid too many return statements within this method.
      Open

          return ExceptionNotification::Notifier.config[:notify_other_errors]
      Severity: Major
      Found in lib/exception_notification/notifiable_helper.rb - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status