smartinez87/exception_notification

View on GitHub

Showing 23 of 23 total issues

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 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 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 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 call has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def call(exception, options = {})
            env = options[:env]
      
            options = options.reverse_merge(@default_options)
            url = options.delete(:url)
      Severity: Minor
      Found in lib/exception_notifier/webhook_notifier.rb - About 1 hr to fix

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

            def initialize(options)
              super
              begin
                api_token         = options.delete(:api_token)
                room_name         = options.delete(:room_name)
        Severity: Minor
        Found in lib/exception_notifier/hipchat_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 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.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, options = {})
              @options = options.merge(@default_options)
              @exception = exception
              @backtrace = exception.backtrace ? clean_backtrace(exception) : nil
        
        
        Severity: Minor
        Found in lib/exception_notifier/teams_notifier.rb - About 1 hr to fix

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

              def information_from_options(exception_class, options)
                errors_count = options[:accumulated_errors_count].to_i
          
                measure_word = if errors_count > 1
                                 errors_count
          Severity: Minor
          Found in lib/exception_notifier/slack_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(exception, options = {})
                @options = options.merge(@default_options)
                @exception = exception
                @backtrace = exception.backtrace ? clean_backtrace(exception) : nil
          
          
          Severity: Minor
          Found in lib/exception_notifier/teams_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 build_message has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def build_message(exception, options)
                exception_name = accumulated_exception_name(exception, options)
          
                if options[:env].nil?
                  text = "#{exception_name} occured in background\n"
          Severity: Minor
          Found in lib/exception_notifier/sns_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 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 data_for_exception_notifier has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def data_for_exception_notifier(exception = nil)
                data = {}
                data[:error_class] = exception.class.name if exception
                data[:error_message] = exception.message if exception
          
          
          Severity: Minor
          Found in lib/exception_notification/rake.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

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

              def call(exception, options = {})
                env = options[:env]
          
                options = options.reverse_merge(@default_options)
                url = options.delete(:url)
          Severity: Minor
          Found in lib/exception_notifier/webhook_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

          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.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

          Method parse_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse_options(options)
                nick = options.fetch(:nick, 'ExceptionNotifierBot')
                password = options[:password] ? ":#{options[:password]}" : nil
                domain = options.fetch(:domain, nil)
                port = options[:port] ? ":#{options[:port]}" : nil
          Severity: Minor
          Found in lib/exception_notifier/irc_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

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

              def initialize(options)
                super
          
                raise ArgumentError, "You must provide 'region' option" unless options[:region]
                raise ArgumentError, "You must provide 'access_key_id' option" unless options[:access_key_id]
          Severity: Minor
          Found in lib/exception_notifier/sns_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