Showing 10 of 23 total issues
Method print
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def print(output)
output.puts "---- MEMORY THRESHOLD ----"
output.puts "THRESHOLD: #{@threshold/1024} MB\n"
output.puts "\n-- REQUESTS --\n" if @format == :verbose
- 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 print
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def print(output)
output.puts "---- OINK FOR ACTIVERECORD ----"
output.puts "THRESHOLD: #{@threshold} Active Record objects per request\n"
output.puts "\n-- REQUESTS --\n" if @format == :verbose
- 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 process
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process
options = { :format => :short_summary, :type => :memory }
op = OptionParser.new do |opts|
opts.banner = "Usage: oink [options] files"
Method print
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print(output)
output.puts "---- MEMORY THRESHOLD ----"
output.puts "THRESHOLD: #{@threshold/1024} MB\n"
output.puts "\n-- REQUESTS --\n" if @format == :verbose
Method print
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print(output)
output.puts "---- OINK FOR ACTIVERECORD ----"
output.puts "THRESHOLD: #{@threshold} Active Record objects per request\n"
output.puts "\n-- REQUESTS --\n" if @format == :verbose
Method included
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(klass)
klass.class_eval do
def self.reset_instance_type_count
self.instantiated_hash = {}
Method print_summary
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_summary(output)
output.puts "\n-- SUMMARY --\n"
output.puts "Worst Requests:"
@bad_requests.each_with_index do |offender, index|
output.puts "#{index + 1}. #{offender.datetime}, #{offender.display_oink_number}, #{offender.action}"
Avoid deeply nested control flow statements. Open
if @format == :verbose
@pids[pid][:buffer].each { |b| output.puts b }
output.puts "---------------------------------------------------------------------"
end
Method process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process
options = { :format => :short_summary, :type => :memory }
op = OptionParser.new do |opts|
opts.banner = "Usage: oink [options] files"
- 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_file_listing
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_file_listing(args)
listing = []
args.each do |file|
unless File.exist?(file)
raise "Could not find \"#{file}\""
- 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"