pboling/exception_notification

View on GitHub

Showing 28 of 28 total issues

Method codes_for_error_classes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def codes_for_error_classes
    #TODO: Format whitespace
    classes = {
      # These are standard errors in rails / ruby
      NameError => "503",
Severity: Minor
Found in lib/exception_notification/helpful_hashes.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 get_view_path has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_view_path(file_name, verbose = false)
    if File.exist?("#{RAILS_ROOT}/public/#{file_name}.html")
      logger.info("[FOUND FILE:A] #{RAILS_ROOT}/public/#{file_name}.html") if verbose
      "#{RAILS_ROOT}/public/#{file_name}.html"
    elsif !config[:view_path].nil? && File.exist?("#{RAILS_ROOT}/#{config[:view_path]}/#{file_name}.html.erb")
Severity: Minor
Found in lib/exception_notification/notifier.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 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 pass_it_on has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

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

      def exception_notification(exception, class_name = nil, method_name = nil, request = nil, data = {}, the_blamed = nil, rejected_sections = nil)
    Severity: Major
    Found in lib/exception_notification/notifier.rb - About 50 mins to fix

      Method error_environment_data_hash has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def error_environment_data_hash(exception, class_name = nil, method_name = nil, request = nil, data = {}, the_blamed = nil, rejected_sections = nil)
      Severity: Major
      Found in lib/exception_notification/notifier.rb - About 50 mins 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 build_web_hook_params has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def self.build_web_hook_params(config, exception, controller, request, data={}, the_blamed = nil)
          Severity: Minor
          Found in lib/exception_notification/hooks_notifier.rb - About 45 mins to fix

            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

              Avoid deeply nested control flow statements.
              Open

                    logger.info("[FOUND FILE:D] #{File.dirname(__FILE__)}/../../rails/app/views/exception_notifiable/#{file_name}.html.erb") if verbose
              Severity: Major
              Found in lib/exception_notification/notifier.rb - About 45 mins to fix

                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 error_environment_data_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def error_environment_data_hash(exception, class_name = nil, method_name = nil, request = nil, data = {}, the_blamed = nil, rejected_sections = nil)
                      data.merge!({
                        :exception => exception,
                        :backtrace => sanitize_backtrace(exception.backtrace),
                        :rails_root => rails_root,
                Severity: Minor
                Found in lib/exception_notification/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 lay_blame has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def lay_blame(exception)
                    error = {}
                    unless(ExceptionNotification::Notifier.config[:git_repo_path].nil?)
                      if(exception.class == ActionView::TemplateError)
                          blame = blame_output(exception.line_number, "app/views/#{exception.file_name}")
                Severity: Minor
                Found in lib/exception_notification/git_blame.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 deliver_exception_to_web_hooks has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def self.deliver_exception_to_web_hooks(config, exception, controller, request, data={}, the_blamed = nil)
                Severity: Minor
                Found in lib/exception_notification/hooks_notifier.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                      elsif File.exist?("#{File.dirname(__FILE__)}/../../rails/app/views/exception_notifiable/#{file_name}.html")
                        logger.info("[FOUND FILE:E] #{File.dirname(__FILE__)}/../../rails/app/views/exception_notifiable/#{file_name}.html") if verbose
                        "#{File.dirname(__FILE__)}/../../rails/app/views/exception_notifiable/#{file_name}.html"
                      else
                        nil
                  Severity: Major
                  Found in lib/exception_notification/notifier.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 rake_exception_notification has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def rake_exception_notification(exception, task, data={}, the_blamed = nil, rejected_sections = %w(request session))
                      Severity: Minor
                      Found in lib/exception_notification/notifier.rb - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language