gecos-team/gecoscc-ui

View on GitHub
gecoscc/api/gpo_import.py

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def post(self):
        """
        Imports and converts XML GPOs into GECOSCC from self.request
        """

Severity: Minor
Found in gecoscc/api/gpo_import.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 _cleanPrefixNamespaces has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _cleanPrefixNamespaces(self, xml):
        if isinstance(xml, dict):
            for old_key in list(xml.keys()):
                old_key_splitted = old_key.split(':')  # namespace prefix separator
                new_key = ':'.join(old_key_splitted[1:]) if len(old_key_splitted) > 1 else old_key
Severity: Minor
Found in gecoscc/api/gpo_import.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

There are no issues that match your filters.

Category
Status