vadv/kurchatov

View on GitHub
lib/kurchatov/mixin/event.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method normalize_event has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def normalize_event(hash = {})

        hash[:description] = hash[:desc] if hash[:description].nil? && hash[:desc]
        hash[:metric] = hash[:metric].to_f if hash[:metric].kind_of?(String)
        if hash[:metric].kind_of?(Float)
Severity: Minor
Found in lib/kurchatov/mixin/event.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 set_avg_metric has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def set_avg_metric(hash ={})

        return if hash[:avg].nil? || hash[:avg].to_i != hash[:avg]
        return if hash[:service].nil?
        return if hash[:metric].nil?
Severity: Minor
Found in lib/kurchatov/mixin/event.rb - About 55 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 set_diff_metric has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def set_diff_metric(hash ={})

        hash[:diff] ||= hash[:as_diff] if hash[:as_diff]

        return if hash[:diff].nil? && !hash[:diff]
Severity: Minor
Found in lib/kurchatov/mixin/event.rb - About 55 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 set_event_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def set_event_state(hash = {})
        return if hash[:state]
        return if hash[:critical].nil? && hash[:warning].nil?
        return if hash[:metric].nil?
        hash[:state] = 'ok'
Severity: Minor
Found in lib/kurchatov/mixin/event.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