Class Panel
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Panel
include ERB::Util
include Rack::Insight::Logging
include Rack::Insight::Render
include Rack::Insight::Database::RequestDataClient
Method content_for_request
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def content_for_request(number)
logger.info("Rack::Insight is using default content_for_request for #{self.class}") if verbose(:med)
if !self.has_table?
logger.info("#{self.class} is being used without a table") if verbose(:med)
content
- 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 current_panel_file
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def current_panel_file(sub)
file_name = nil
matched_line = nil
caller.each do |line|
# First make sure we are not matching rack-insight's own panel class, which will be in the caller stack,
- 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 heading_for_request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def heading_for_request(number)
if !self.has_table?
heading
else
num = count(number)
- 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 initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(app)
if panel_app
#XXX use mappings
@app = Rack::Cascade.new([panel_app, app])
else
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(app)
if panel_app
#XXX use mappings
@app = Rack::Cascade.new([panel_app, app])
else
- 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 from_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def from_file(rel_path)
old_rel, Thread::current['rack-panel_file'] = Thread::current['rack-panel_file'], rel_path
num_load_paths_to_check = Rack::Insight::Config.config[:panel_load_paths].length
Rack::Insight::Config.config[:panel_load_paths].each_with_index do |load_path, index|
begin
- 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"