Showing 26 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",
- Read upRead up
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")
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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)
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
- Read upRead up
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 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
- Read upRead up
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)
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)
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)
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)
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,
- Read upRead up
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 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
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)
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)
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
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}")
- Read upRead up
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))
- Read upRead up
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 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))
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)