yieldbot/sensu-yieldbot-plugins

View on GitHub

Showing 9 of 34 total issues

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

  def run
    # If only one cluster is given, no need to check the indexes
    ok 'All indexes are unique' if config[:cluster].length == 1

    port = ':9200'
Severity: Minor
Found in plugins/elasticsearch/check-es-indexes.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 read_inode_pct has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def read_inode_pct # rubocop:disable all
    `df -iPT`.split("\n").drop(1).each do |line|
      begin
        _fs, type, _blocks, _used, _avail, inode_usage, mnt = line.split
        next if config[:includeline] && !config[:includeline]
Severity: Minor
Found in plugins/system/check-inode-free.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

Function get_status has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def get_status(host, region):
    output = "\n"
    con = httplib.HTTPConnection(host,timeout=45)
    for i in range(len(cgnodes[region])):
        try:
Severity: Minor
Found in plugins/bongo/check-cgnode-mm-health.py - 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 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    # If only one cluster is given, no need to check the indexes
    ok 'All indexes are unique' if config[:cluster].length == 1

    port = ':9200'
Severity: Minor
Found in plugins/elasticsearch/check-es-indexes.rb - About 1 hr to fix

    Function check_tribe_node has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_tribe_node(cluster):
        conn = httplib.HTTPConnection(cluster)
        now = datetime.datetime.utcnow()
        output = []
        for i in range(1,7):
    Severity: Minor
    Found in plugins/elasticsearch/check-es-tribe-node.py - 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 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        if config[:includeline] && config[:ignoreline]
          unknown 'Do not use -l and -L options concurrently'
        end
        read_inode_pct
    Severity: Minor
    Found in plugins/system/check-inode-free.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

    Function check_hotevents_cluster has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_hotevents_cluster(cluster):
        now = datetime.datetime.utcnow()
        missing = ""
        indices = []
        for i in range(2):
    Severity: Minor
    Found in plugins/elasticsearch/check-es-tribe-index.py - 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

    Function check_aggregation_cluster has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_aggregation_cluster(cluster):
        now = datetime.datetime.utcnow()
        missing = ""
        indices = []
        for i in range(2):
    Severity: Minor
    Found in plugins/elasticsearch/check-es-tribe-index.py - 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

    Function check_coldevents_cluster has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_coldevents_cluster(cluster):
        now = datetime.datetime.utcnow()
        missing = ""
        indices = []
        for i in range(2):
    Severity: Minor
    Found in plugins/elasticsearch/check-es-tribe-index.py - 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