netdata/netdata

View on GitHub
src/collectors/python.d.plugin/oracledb/oracledb.chart.py

Summary

Maintainability
D
2 days
Test Coverage

File oracledb.chart.py has 720 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Description: oracledb netdata python.d module
# Author: ilyam8 (Ilya Mashchenko)
# SPDX-License-Identifier: GPL-3.0-or-later

Severity: Major
Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - About 1 day to fix

    Function get_data has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_data(self):
            if not self.alive and not self.reconnect():
                return None
    
            data = dict()
    Severity: Minor
    Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - About 4 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 gather_tablespace_metrics has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def gather_tablespace_metrics(self):
            """
            :return:
    
            [['SYSTEM', 874250240.0, 3233169408.0, 27.040038107400033, 0],
    Severity: Minor
    Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.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

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

        def gather_allocated_metrics(self):
            """
            :return:
    
            [['SYSTEM', 874250240.0, 3233169408.0, 27.040038107400033, 0],
    Severity: Minor
    Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.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

    Function connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def connect(self):
            if self.conn:
                self.conn.close()
                self.conn = None
            if HAS_ORACLE_NEW:
    Severity: Minor
    Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - 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 function.
    Open

                return None
    Severity: Major
    Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return None
      Severity: Major
      Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return data or None
        Severity: Major
        Found in src/collectors/python.d.plugin/oracledb/oracledb.chart.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status