File diagnose.rb
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rbconfig"
require "etc"
require "appsignal/cli/diagnose/utils"
require "appsignal/cli/diagnose/paths"
Class Diagnose
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Diagnose
extend CLI::Helpers
DIAGNOSE_ENDPOINT = "https://appsignal.com/diag".freeze
Method agent_diagnostic_test_definition
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def agent_diagnostic_test_definition
{
"extension" => {
:label => "Extension tests",
:tests => {
Method send_report_to_appsignal?
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_report_to_appsignal?(options)
puts "\nDiagnostics report"
puts " Do you want to send this diagnostics report to AppSignal?"
puts " If you share this report you will be given a link to \n" \
" AppSignal.com to validate the report.\n" \
Method host_information
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def host_information
rbconfig = RbConfig::CONFIG
puts "Host information"
data_section :host do
puts_and_save :architecture, "Architecture", rbconfig["host_cpu"]
- 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 send_report_to_appsignal?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_report_to_appsignal?(options)
puts "\nDiagnostics report"
puts " Do you want to send this diagnostics report to AppSignal?"
puts " If you share this report you will be given a link to \n" \
" AppSignal.com to validate the report.\n" \
- 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_agent_test
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def print_agent_test(definition, test)
value = test["result"]
error = test["error"]
output = test["output"]
- 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"