erikvw/django-collect-offline

View on GitHub
django_collect_offline/site_offline_models.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function autodiscover has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def autodiscover(self, module_name=None):
        module_name = module_name or self.module_name
        sys.stdout.write(" * checking for models to register ...\n")
        for app in django_apps.app_configs:
            try:
Severity: Minor
Found in django_collect_offline/site_offline_models.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 register has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def register(self, models=None, wrapper_cls=None):
        """Registers with app_label.modelname, wrapper_cls.
        """
        if get_offline_enabled():
            self.loaded = True
Severity: Minor
Found in django_collect_offline/site_offline_models.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 register_for_app has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def register_for_app(
        self, app_label=None, exclude_models=None, exclude_model_classes=None
    ):
        """Registers all models for this app_label.
        """
Severity: Minor
Found in django_collect_offline/site_offline_models.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