sensu-plugins/sensu-plugins-cassandra

View on GitHub

Showing 6 of 10 total issues

Method parse_cfstats has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_cfstats
    def get_metric(string) # rubocop:disable Lint/NestedMethodDefinition
      string.strip!
      (metric, value) = string.split(': ')
      if metric.nil? || value.nil? # rubocop:disable Style/GuardClause
Severity: Minor
Found in bin/metrics-cassandra-graphite.rb - About 3 hrs 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_info has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_info
    info = nodetool_cmd('info')
    # #YELLOW
    # TODO: come back and refactor me to be better
    info.each_line do |line| # rubocop:disable Metrics/BlockLength
Severity: Minor
Found in bin/metrics-cassandra-graphite.rb - About 2 hrs 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_info has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_info
    info = nodetool_cmd('info')
    # #YELLOW
    # TODO: come back and refactor me to be better
    info.each_line do |line| # rubocop:disable Metrics/BlockLength
Severity: Minor
Found in bin/metrics-cassandra-graphite.rb - About 1 hr to fix

    Method parse_cfstats has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_cfstats
        def get_metric(string) # rubocop:disable Lint/NestedMethodDefinition
          string.strip!
          (metric, value) = string.split(': ')
          if metric.nil? || value.nil? # rubocop:disable Style/GuardClause
    Severity: Minor
    Found in bin/metrics-cassandra-graphite.rb - About 1 hr to fix

      Method run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          out, rc = nodetool_cmd('describecluster')
          if rc != 0
            critical(out)
          end
      Severity: Minor
      Found in bin/check-cassandra-schema.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 parse_tpstats has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse_tpstats# rubocop:disable all
          tpstats = nodetool_cmd('tpstats')
          tpstats.each_line do |line|
            next if line =~ /^Pool Name/
            next if line =~ /^Message type/
      Severity: Minor
      Found in bin/metrics-cassandra-graphite.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

      Severity
      Category
      Status
      Source
      Language