conan-io/conan

View on GitHub
conans/model/lock_bundle.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function update_bundle has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

    def update_bundle(bundle_path, revisions_enabled):
        """ Update both the bundle information as well as every individual lockfile, from the
        information that was modified in the individual lockfile. At the end, all lockfiles will
        have the same PREV for the binary of same package_id
        """
Severity: Minor
Found in conans/model/lock_bundle.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 create has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

    def create(lockfiles, revisions_enabled, cwd):
        def ref_convert(r):
            # Necessary so "build-order" output is usable by install
            if "@" not in r:
                if "#" in r:
Severity: Minor
Found in conans/model/lock_bundle.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

Avoid deeply nested control flow statements.
Open

                        if prev is None:
                            prev = lock_prev
                            prev_lockfile = lockfile
                            modified = graph_lock.nodes[node_id].modified
                        elif lock_prev is not None and prev != lock_prev:
Severity: Major
Found in conans/model/lock_bundle.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if graph_lock.nodes[node_id].prev is None:
                                graph_lock.nodes[node_id].prev = prev
                        graph_lock_conf.save(lockfile)
    Severity: Major
    Found in conans/model/lock_bundle.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status