sensu-plugins/sensu-plugins-gluster

View on GitHub

Showing 3 of 3 total issues

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

  def run
    errors = []
    `sudo gluster volume status`.each_line do |l|
      # Don't match those lines or conditions.
      next unless l =~ / N /
Severity: Minor
Found in bin/check-gluster-status.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    errors = []
    # #YELLOW
    `sudo gluster volume geo-replication status`.each_line do |l|
      # Don't match those lines or conditions.
Severity: Minor
Found in bin/check-gluster-georepl-status.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 print_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def print_hash(hash, path = '')
    hash.each do |key, value|
      new_path = "#{path}.#{key}"
      if value.is_a? Hash
        print_hash(value, new_path)
Severity: Minor
Found in lib/sensu-plugins-gluster/common_gluster.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