netdata/netdata

View on GitHub
integrations/gen_docs_integrations.py

Summary

Maintainability
D
2 days
Test Coverage

Function build_readme_from_integration has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

def build_readme_from_integration(integration, mode=''):
    # COLLECTORS
    if mode == 'collector':

        try:
Severity: Minor
Found in integrations/gen_docs_integrations.py - About 5 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 write_to_file has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

def write_to_file(path, md, meta_yaml, sidebar_label, community, mode='default'):
    """
    takes the arguments needed to write the integration markdown to the proper file.
    """

Severity: Minor
Found in integrations/gen_docs_integrations.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

File gen_docs_integrations.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import shutil
from pathlib import Path
import re

Severity: Minor
Found in integrations/gen_docs_integrations.py - About 3 hrs to fix

    Function cleanup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def cleanup():
        """
        clean directories that are either data collection or exporting integrations
        """
        for element in Path("src/go/collectors/go.d.plugin/modules").glob('**/*/'):
    Severity: Minor
    Found in integrations/gen_docs_integrations.py - About 2 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 generate_category_from_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_category_from_name(category_fragment, category_array):
        """
        Takes a category ID in splitted form ("." as delimiter) and the array of the categories, and returns the proper category name that Learn expects.
        """
    
    
    Severity: Minor
    Found in integrations/gen_docs_integrations.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 write_to_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def write_to_file(path, md, meta_yaml, sidebar_label, community, mode='default'):
    Severity: Minor
    Found in integrations/gen_docs_integrations.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status