netdata/netdata

View on GitHub
.github/scripts/netdata-pkgcloud-cleanup.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function get_all_packages has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all_packages(self):
        page = 1
        all_pkg_list = []
        while True:
            url = f"{self.base_url}/packages.json?page={page}"
Severity: Minor
Found in .github/scripts/netdata-pkgcloud-cleanup.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 cleanup_stable_repo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def cleanup_stable_repo(self):
        all_pkg_list = self.get_all_packages()
        all_distros = list(set([ pkg['distro_version'] for pkg in all_pkg_list ]))
        all_distros = sorted(all_distros)
        print(f"<> Distributions list: {all_distros}")
Severity: Minor
Found in .github/scripts/netdata-pkgcloud-cleanup.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

Avoid deeply nested control flow statements.
Open

                        if element['name'] != 'netdata-repo' and element['name'] != 'netdata-repo-edge':
                            all_pkg_list.append(element)
            page += 1
Severity: Major
Found in .github/scripts/netdata-pkgcloud-cleanup.py - About 45 mins to fix

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

        def cleanup_edge_repo(self):
            all_pkg_list = self.get_all_packages()
            pkgs_to_delete = []
            pkgs_to_keep = []
            for package in all_pkg_list:
    Severity: Minor
    Found in .github/scripts/netdata-pkgcloud-cleanup.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