Stibbons/dopplerr

View on GitHub
cfgtree/cfgtree.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function _inject_cfg_in_parser has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def _inject_cfg_in_parser(self, parser, xpath=None, root=None):
        """
        Configure the argument parser according to cfgtree.
        """
        if root is None:
Severity: Minor
Found in cfgtree/cfgtree.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 _load_environment_variables has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_environment_variables(self, xpath, root):
        """
        Inject value from environment variable.
        """
        for name, item in root.items():
Severity: Minor
Found in cfgtree/cfgtree.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 _find_cfg_for_cmd_line_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _find_cfg_for_cmd_line_name(self, cmd_line_name, root=None):
        if root is None:
            root = self.cfgtree
        for v in root.values():
            if isinstance(v, dict):
Severity: Minor
Found in cfgtree/cfgtree.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 _inject_names has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _inject_names(self, root=None, xpath=None):
        """
        Inject configuration item name defined in the cfgtree dict inside each `_Cfg`.
        """
        if root is None:
Severity: Minor
Found in cfgtree/cfgtree.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 _dict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _dict(self, root=None, safe=False):
        """
        Return the configuration as a dictionnary.
        """
        if root is None:
Severity: Minor
Found in cfgtree/cfgtree.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 _load_cfg_dict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_cfg_dict(self, cfg, xpath=None):
        for k, v in cfg.items():
            xp = self.mkxpath(xpath, k)
            if isinstance(v, dict):
                self._load_cfg_dict(v, xp)
Severity: Minor
Found in cfgtree/cfgtree.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_cmd_line_arg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_cmd_line_arg(self):
        """
        Inject parameters provider by the user in the command line.
        """
        argv = sys.argv[1:]
Severity: Minor
Found in cfgtree/cfgtree.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