appsignal/appsignal

View on GitHub
lib/appsignal/cli/diagnose.rb

Summary

Maintainability
D
2 days
Test Coverage

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"

Severity: Minor
Found in lib/appsignal/cli/diagnose.rb - About 7 hrs to fix

    Class Diagnose has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Diagnose
          extend CLI::Helpers
    
          DIAGNOSE_ENDPOINT = "https://appsignal.com/diag".freeze
    
    
    Severity: Minor
    Found in lib/appsignal/cli/diagnose.rb - About 4 hrs to fix

      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 => {
      Severity: Major
      Found in lib/appsignal/cli/diagnose.rb - About 2 hrs to fix

        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" \
        Severity: Minor
        Found in lib/appsignal/cli/diagnose.rb - About 1 hr to fix

          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"]
          Severity: Minor
          Found in lib/appsignal/cli/diagnose.rb - About 35 mins to fix

          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" \
          Severity: Minor
          Found in lib/appsignal/cli/diagnose.rb - About 35 mins to fix

          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"]
          
          
          Severity: Minor
          Found in lib/appsignal/cli/diagnose.rb - About 25 mins to fix

          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

          There are no issues that match your filters.

          Category
          Status