Showing 10 of 12 total issues
Class Agent
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Agent
def self.default_config
{
api_url: "https://www.rorvswild.com/api/v1",
ignore_exceptions: default_ignored_exceptions,
Method initialize
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice)
Method serve_embed_profiler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def serve_embed_profiler(env)
status, headers, body = app.call(env)
status = status.to_i
if status >= 200 && status < 300 && headers["Content-Type"] && headers["Content-Type"].include?("text/html")
if headers["Content-Encoding"]
- 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 merge
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def merge(section)
self.calls += section.calls
self.total_runtime += section.total_runtime
self.children_runtime += section.children_runtime
if section
- 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_from_capistrano
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.read_from_capistrano
return unless File.readable?("REVISION")
return unless @revision = File.read("REVISION")
lines = `git --git-dir ../../repo log --format=%an%n%ae%n%B -n 1 #{@revision}`.lines rescue nil
return unless lines
- 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 setup_plugins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def setup_plugins
for name in RorVsWild::Plugin.constants
next if config[:ignore_plugins] && config[:ignore_plugins].include?(name.to_s)
if (plugin = RorVsWild::Plugin.const_get(name)).respond_to?(:setup)
RorVsWild.logger.debug("Setup RorVsWild::Plugin::#{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 read_from_git
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.read_from_git
@revision = normalize_string(`git rev-parse HEAD`) rescue nil
return unless @revision
lines = `git log -1 --pretty=%an%n%ae%n%B`.lines rescue nil
return unless lines
- 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 inject_into
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def inject_into(html)
if index = html.index("</body>")
markup = File.read(File.join(LOCAL_FOLDER, "local.html.erb"))
markup = ERB.new(markup).result(binding)
markup = markup.html_safe if markup.respond_to?(:html_safe)
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(string)
for row in string.lines
if row.start_with?("cpu ")
array = row.split[1..-1].map(&:to_i)[0,10]
array.fill(0, array.size, 10 - array.size) if array.size < 10
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
if @old_stat && (new_stat = Stat.read)
if (total = new_stat.total - @old_stat.total) > 0
@user = (new_stat.user - @old_stat.user) * 100 / total
@system = (new_stat.system - @old_stat.system) * 100 / total
- 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"