sensu-plugins/sensu-plugins-graphite

View on GitHub

Showing 23 of 33 total issues

Method retrieve_data! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def retrieve_data!
        unless @raw_data
          begin
            unless config[:server].start_with?('https://', 'http://')
              config[:server].prepend('http://')
Severity: Minor
Found in lib/sensu-plugins-graphite/graphite_proxy/proxy.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    messages = []
    servers = config[:servers].split(',')
    relay_ips = find_relay_ips(config[:relays].split(','))

Severity: Minor
Found in bin/check-graphite-replication.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

Avoid too many return statements within this method.
Open

          return [1, "#{metric['target']} is #{avg}"]
Severity: Major
Found in bin/check-graphite-stats.rb - About 30 mins to fix
    Severity
    Category
    Status
    Source
    Language