jedymatt/sqlalchemyseed

View on GitHub

Showing 5 of 5 total issues

Function _seed_where has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _seed_where(self, model_class: sqlalchemy.orm.mapper, where: dict):
        instances = []

        if isinstance(where, dict):
            instance = self._seed_dict_where(model_class, where)
Severity: Minor
Found in src/sqlalchemyseed/seeder.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 _seed_data_ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _seed_data_(self, model_class: sqlalchemy.orm.mapper, data_: dict) -> list:
        instances = []

        if isinstance(data_, dict):
            instance = self._instantiate_model_class(model_class, data_)
Severity: Minor
Found in src/sqlalchemyseed/seeder.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 exec_func_iter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def exec_func_iter(self, func: Callable):
        """
        Executes function when iterating
        """
        current = self._current
Severity: Minor
Found in src/sqlalchemyseed/json.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 _seed_rel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _seed_rel(self, rel: dict, instance: sqlalchemy.orm.mapper):
        for key, value in rel.items():
            if isinstance(value, dict):
                self._seed_rel_attribute_value(instance, key, value)
            elif isinstance(value, list):
Severity: Minor
Found in src/sqlalchemyseed/seeder.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 set_instance_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def set_instance_attribute(instance, attribute_name, value):
    """
    Set attribute value of instance
    """

Severity: Minor
Found in src/sqlalchemyseed/attribute.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

Severity
Category
Status
Source
Language