WesternFriend/WF-website

View on GitHub

Showing 4 of 9 total issues

Function handle has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def handle(self, *args: tuple, **options: dict[str, str]) -> None:
        root_page = get_or_create_site_root_page()

        home_page = HomePage(
            title="Welcome",
Severity: Major
Found in cli/management/commands/scaffold_initial_content.py - About 3 hrs to fix

    Function get_context has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_context(
            self,
            request: HttpRequest,
            *args: tuple,
            **kwargs: dict,
    Severity: Minor
    Found in news/models.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 generateAutoslug has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function generateAutoslug() {
      /*
      Auto-generate slug from given and family name fields.
      This is used for adding Person contacts and Memorials
      */
    Severity: Minor
    Found in contact/static/js/contact/person_url_slug.js - 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

    Function create_news_item_topic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_news_item_topic(self, create, extracted, **kwargs):
            """Create a NewsItemTopic for the NewsItem."""
            if not create or "news_item" in kwargs:
                # Avoid recursion if 'news_item' is in kwargs
                return
    Severity: Minor
    Found in news/factories.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