File exception_presenter.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring.
RSpec::Support.require_rspec_core "formatters/console_codes"
RSpec::Support.require_rspec_core "formatters/snippet_extractor"
RSpec::Support.require_rspec_core 'formatters/syntax_highlighter'
RSpec::Support.require_rspec_support "encoded_string"
Class ExceptionPresenter
has 27 methods (exceeds 20 allowed). Consider refactoring.
class ExceptionPresenter
attr_reader :exception, :example, :description, :message_color,
:detail_formatter, :extra_detail_formatter, :backtrace_formatter
private :message_color, :detail_formatter, :extra_detail_formatter, :backtrace_formatter
Method formatted_cause
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
def formatted_cause(exception)
last_cause = final_exception(exception, [exception])
cause = []
if exception.cause
- 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 read_failed_lines
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def read_failed_lines
matching_line = find_failed_line
unless matching_line
return ["Unable to find matching line from backtrace"]
end
- 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 multiple_exception_summarizer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def multiple_exception_summarizer(exception, prior_detail_formatter, color)
lambda do |example, colorizer|
summary = if exception.aggregation_metadata[:hide_backtrace]
# Since the backtrace is hidden, the subfailures will come
# immediately after this, and using `:` will read well.
- 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"