aredondo/check_passenger

View on GitHub

Showing 9 of 9 total issues

Method check_counter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def check_counter(counter_name, options = {})
        load_parsed_data(options)
        output_data = []

        counter = parsed_data.send(counter_name.to_sym, options[:app_name])
Severity: Minor
Found in lib/check_passenger/check.rb - About 1 hr to fix

    Method parse_passenger_status_output has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_passenger_status_output
          passenger_status_output =~ /^(.*?)-+ +Application groups +-+[^\n]*\n(.*)$/m
          fail StatusOutputError.new('Did not find "Application groups" section', passenger_status_output) unless $1
    
          generic_data = $1
    Severity: Minor
    Found in lib/check_passenger/parser.rb - About 1 hr 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 passenger_status_executable_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def passenger_status_executable_path
            command = if @path and File.exist?(@path)
                        if File.directory?(@path)
                          File.expand_path('passenger-status', @path)
                        else
    Severity: Minor
    Found in lib/check_passenger/passenger_status.rb - About 45 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 life_to_seconds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def life_to_seconds(last_used)
          last_used.split(/\s+/).reduce(0) do |sum, part|
            if part =~ /^(\d+)([a-z])$/
              unless UNIT_MULTIPLIERS.key?($2)
                fail StatusOutputError.new("Unknown time unit '#{$2}' in '#{last_used}'", passenger_status_output)
    Severity: Minor
    Found in lib/check_passenger/parser.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 nagios_format_output has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def nagios_format_output(data)
          data = [data] unless data.is_a?(Array)
          main_status = nil
          status_data = []
          perf_data = []
    Severity: Minor
    Found in lib/check_passenger/nagios_check.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 check_counter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def check_counter(counter_name, options = {})
            load_parsed_data(options)
            output_data = []
    
            counter = parsed_data.send(counter_name.to_sym, options[:app_name])
    Severity: Minor
    Found in lib/check_passenger/check.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 counter_with_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def counter_with_label(counter, counter_type)
            counter_type = counter_type.to_sym
    
            unless COUNTER_LABELS.keys.include?(counter_type)
              fail ArgumentError, "Unknown counter type: #{counter_type}"
    Severity: Minor
    Found in lib/check_passenger/check.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 parse_application_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_application_data(output)
          output.split("\n\n").map do |app_output|
            app_data = {}
    
            app_output =~ /App root: +([^\n]+)/
    Severity: Minor
    Found in lib/check_passenger/parser.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

    Method application_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def application_data(app_name)
          if app_name
            data = @application_data.select { |d| d[:name].include?(app_name) }
            if data.size == 0
              fail NoApplicationError.new('Application is not running', app_name)
    Severity: Minor
    Found in lib/check_passenger/parser.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

    Severity
    Category
    Status
    Source
    Language