pboling/exception_notification

View on GitHub
lib/exception_notification/exception_notifiable.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method notify_and_render_error_template has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def notify_and_render_error_template(status_cd, request, exception, file_path, verbose = false)
      logger.info "notify_and_render_error_template"
      status = self.class.http_status_codes[status_cd] ? status_cd + " " + self.class.http_status_codes[status_cd] : status_cd
      data = get_exception_data
      #We only send email if it has been configured in environment
Severity: Minor
Found in lib/exception_notification/exception_notifiable.rb - About 55 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 pass_it_on has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def pass_it_on(exception, env, request = {:params => {}}, params = {}, session = {}, verbose = false)
      begin
        case self.class.exception_notifiable_pass_through
          when :hoptoad then
            HoptoadNotifier.notify(exception, sen_hoptoad_request_data(env, request, params, session))
Severity: Minor
Found in lib/exception_notification/exception_notifiable.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 pass_it_on has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def pass_it_on(exception, env, request = {:params => {}}, params = {}, session = {}, verbose = false)
Severity: Minor
Found in lib/exception_notification/exception_notifiable.rb - About 45 mins to fix

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

        def notify_and_render_error_template(status_cd, request, exception, file_path, verbose = false)
    Severity: Minor
    Found in lib/exception_notification/exception_notifiable.rb - About 35 mins to fix

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

          def rescue_with_handler(exception)
            to_return = super
            # Not sure how to do this. We aren't supposed to rely on the return value of the super handler.
            #if to_return
              verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?
      Severity: Minor
      Found in lib/exception_notification/exception_notifiable.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