netdata/netdata

View on GitHub
integrations/gen_integrations.py

Summary

Maintainability
F
3 days
Test Coverage

File gen_integrations.py has 574 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3

import json
import os
import re
Severity: Major
Found in integrations/gen_integrations.py - About 1 day to fix

    Function render_collectors has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def render_collectors(categories, collectors, ids):
        debug('Computing default categories.')
    
        default_cats, valid_cats = get_category_sets(categories)
    
    
    Severity: Minor
    Found in integrations/gen_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 render_exporters has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def render_exporters(categories, exporters, ids):
        debug('Sorting exporters.')
    
        sort_integrations(exporters)
    
    
    Severity: Minor
    Found in integrations/gen_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 render_authentications has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def render_authentications(categories, authentications, ids):
        debug('Sorting authentications.')
    
        sort_integrations(authentications)
    
    
    Severity: Minor
    Found in integrations/gen_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 render_notifications has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def render_notifications(categories, notifications, ids):
        debug('Sorting notifications.')
    
        sort_integrations(notifications)
    
    
    Severity: Minor
    Found in integrations/gen_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 render_deploy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def render_deploy(distros, categories, deploy, ids):
        debug('Sorting deployments.')
    
        sort_integrations(deploy)
    
    
    Severity: Minor
    Found in integrations/gen_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 get_collector_metadata_entries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_collector_metadata_entries():
        ret = []
    
        for r, d, m in COLLECTOR_SOURCES:
            if d.exists() and d.is_dir() and m:
    Severity: Minor
    Found in integrations/gen_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 get_category_sets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_category_sets(categories):
        default = set()
        valid = set()
    
        for c in categories:
    Severity: Minor
    Found in integrations/gen_integrations.py - 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

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

    def load_notifications():
        ret = []
    
        for repo, path, match in NOTIFICATION_SOURCES:
            if match and path.exists() and path.is_dir():
    Severity: Minor
    Found in integrations/gen_integrations.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

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

    def load_authentications():
        ret = []
    
        for repo, path, match in AUTHENTICATION_SOURCES:
            if match and path.exists() and path.is_dir():
    Severity: Minor
    Found in integrations/gen_integrations.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

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

    def load_collectors():
        ret = []
    
        entries = get_collector_metadata_entries()
    
    
    Severity: Minor
    Found in integrations/gen_integrations.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

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

    def load_deploy():
        ret = []
    
        for repo, path, match in DEPLOY_SOURCES:
            if match and path.exists() and path.is_dir():
    Severity: Minor
    Found in integrations/gen_integrations.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

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

    def load_exporters():
        ret = []
    
        for repo, path, match in EXPORTER_SOURCES:
            if match and path.exists() and path.is_dir():
    Severity: Minor
    Found in integrations/gen_integrations.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

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

    def _load_authentication_file(file, repo):
        debug(f'Loading { file }.')
        data = load_yaml(file)
    
        if not data:
    Severity: Minor
    Found in integrations/gen_integrations.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 _load_exporter_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _load_exporter_file(file, repo):
        debug(f'Loading { file }.')
        data = load_yaml(file)
    
        if not data:
    Severity: Minor
    Found in integrations/gen_integrations.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 _load_notification_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _load_notification_file(file, repo):
        debug(f'Loading { file }.')
        data = load_yaml(file)
    
        if not data:
    Severity: Minor
    Found in integrations/gen_integrations.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

    There are no issues that match your filters.

    Category
    Status