nephila/djangocms-apphook-setup

View on GitHub

Showing 5 of 7 total issues

Function _setup_pages has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def _setup_pages(cls, config):
        """
        Create the page structure.

        It created a home page (if not exists) and a sub-page, and attach the Apphook to the
Severity: Minor
Found in djangocms_apphook_setup/base.py - About 4 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 towncrier_check has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def towncrier_check(c):  # NOQA
    """Check towncrier files."""
    output = io.StringIO()
    c.run("git branch --contains HEAD", out_stream=output)
    skipped_branch_prefix = ["pull/", "develop", "master", "HEAD"]
Severity: Minor
Found in tasks.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_page has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _create_page(
Severity: Major
Found in djangocms_apphook_setup/base.py - About 1 hr to fix

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

        def setup(cls):
            """
            Main method to auto setup Apphook
    
            It must be called after the Apphook registration::
    Severity: Minor
    Found in djangocms_apphook_setup/base.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 config:
                                if cls.auto_setup["config_translated_fields"]:
                                    cls._create_config_translation(config, lang)
                                namespace = config.namespace
                            elif cls.app_name:
    Severity: Major
    Found in djangocms_apphook_setup/base.py - About 45 mins to fix
      Severity
      Category
      Status
      Source
      Language