rails-engine/exception-track

View on GitHub

Showing 7 of 7 total issues

Method initialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(app, options = {})
      @app = app

      ExceptionNotifier.tap do |en|
        en.ignored_exceptions = options.delete(:ignore_exceptions) if options.key?(:ignore_exceptions)
Severity: Minor
Found in lib/exception_notification/rack.rb - About 2 hrs 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 initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(app, options = {})
      @app = app

      ExceptionNotifier.tap do |en|
        en.ignored_exceptions = options.delete(:ignore_exceptions) if options.key?(:ignore_exceptions)
Severity: Minor
Found in lib/exception_notification/rack.rb - About 1 hr to fix

    Method notify_exception has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def notify_exception(exception, options = {}, &block)
          return false if ignored_exception?(options[:ignore_exceptions], exception)
          return false if ignored?(exception, options)
    
          if error_grouping
    Severity: Minor
    Found in lib/exception_notifier/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 call has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def call(exception, opts = {})
          return unless ExceptionTrack.config.enabled_env?(Rails.env)
    
          # send the notification
          title = exception.message || "None"
    Severity: Minor
    Found in lib/exception_notifier/db_notifier.rb - About 1 hr to fix

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

          def call(exception, opts = {})
            return unless ExceptionTrack.config.enabled_env?(Rails.env)
      
            # send the notification
            title = exception.message || "None"
      Severity: Minor
      Found in lib/exception_notifier/db_notifier.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 call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def call(env)
            _, headers, = response = @app.call(env)
      
            if !@ignore_cascade_pass && headers["X-Cascade"] == "pass"
              msg = "This exception means that the preceding Rack middleware set the 'X-Cascade' header to 'pass' -- in " \
      Severity: Minor
      Found in lib/exception_notification/rack.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 notifier_ignored? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def notifier_ignored?(exception, options, notifier:)
            return false unless @@by_notifier_ignores.key?(notifier)
      
            condition = @@by_notifier_ignores[notifier]
            condition.call(exception, options)
      Severity: Minor
      Found in lib/exception_notifier/notifier.rb - About 25 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

      Severity
      Category
      Status
      Source
      Language