core/controllers/acl_decorators.py

Summary

Maintainability
F
2 wks
Test Coverage

File acl_decorators.py has 3688 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8
#
# Copyright 2017 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in core/controllers/acl_decorators.py - About 1 wk to fix

    Function get_decorator_for_accepting_suggestion has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_decorator_for_accepting_suggestion(
        decorator: Callable[[Callable[..., None]], Callable[..., None]]
    ) -> Callable[[Callable[..., None]], Callable[..., None]]:
        """Function that takes a decorator as an argument and then applies some
        common checks and then checks the permissions specified by the passed in
    Severity: Minor
    Found in core/controllers/acl_decorators.py - About 3 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 can_access_story_viewer_page_as_logged_in_user has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_access_story_viewer_page_as_logged_in_user(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., Optional[_GenericHandlerFunctionReturnType]]:
        """Decorator to check whether the user can access story viewer page
        if the user is logged in.
    Severity: Minor
    Found in core/controllers/acl_decorators.py - About 3 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 can_access_story_viewer_page has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_access_story_viewer_page(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., Optional[_GenericHandlerFunctionReturnType]]:
        """Decorator to check whether user can access story viewer page.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.py - About 3 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 can_update_suggestion has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_update_suggestion(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the current user can update suggestions.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_access_subtopic_viewer_page has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_access_subtopic_viewer_page(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., Optional[_GenericHandlerFunctionReturnType]]:
        """Decorator to check whether user can access subtopic page viewer.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_view_reviewable_suggestions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_view_reviewable_suggestions(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., Optional[_GenericHandlerFunctionReturnType]]:
        """Decorator to check whether user can view the list of suggestions that
        they are allowed to review.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_manage_contributors_role has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_manage_contributors_role(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator that checks if the current user can modify contributor's role
        for the contributor dashboard page.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_edit_story has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_edit_story(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can edit a story belonging to a given
        topic.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_add_voice_artist has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_add_voice_artist(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can add voice artist to
        the given activity.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_add_new_story_to_topic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_add_new_story_to_topic(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can add a story to a given topic.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_edit_topic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_edit_topic(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can edit given topic."""
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_access_topic_viewer_page has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_access_topic_viewer_page(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., Optional[_GenericHandlerFunctionReturnType]]:
        """Decorator to check whether user can access topic viewer page.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_comment_on_feedback_thread has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_comment_on_feedback_thread(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can comment on feedback thread.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_remove_voice_artist has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_remove_voice_artist(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can remove voice artist
        from the given activity.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_delete_blog_post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_delete_blog_post(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether user can delete blog post.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_edit_blog_post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_edit_blog_post(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether user can edit blog post.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_delete_story has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_delete_story(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can delete a story in a given
        topic.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_play_exploration_as_logged_in_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_play_exploration_as_logged_in_user(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether user can play given exploration if the user
        is logged in.
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_view_feedback_thread has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_view_feedback_thread(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator to check whether the user can view a feedback thread.
    
    
    Severity: Minor
    Found in core/controllers/acl_decorators.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 can_access_contributor_dashboard_admin_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def can_access_contributor_dashboard_admin_page(
        handler: Callable[..., _GenericHandlerFunctionReturnType]
    ) -> Callable[..., _GenericHandlerFunctionReturnType]:
        """Decorator that checks if the user can access the contributor dashboard
        admin page.
    Severity: Minor
    Found in core/controllers/acl_decorators.py - About 45 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 test_can_access has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def test_can_access(
    Severity: Minor
    Found in core/controllers/acl_decorators.py - About 45 mins to fix

      Function test_can_access has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def test_can_access(  # pylint: disable=too-many-return-statements
      Severity: Minor
      Found in core/controllers/acl_decorators.py - About 45 mins to fix

        Function test_can_access has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def test_can_access(
        Severity: Minor
        Found in core/controllers/acl_decorators.py - About 45 mins to fix

          Function test_can_fetch_contributor_dashboard_stats has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def test_can_fetch_contributor_dashboard_stats(
          Severity: Minor
          Found in core/controllers/acl_decorators.py - About 35 mins to fix

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

            def can_view_question_editor(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can view any question editor.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_edit_exploration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_edit_exploration(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can edit given exploration.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_voiceover_exploration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_voiceover_exploration(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can voiceover given exploration.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_delete_topic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_delete_topic(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can delete a topic.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_change_topic_publication_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_change_topic_publication_status(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can publish or unpublish a topic.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_download_exploration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_download_exploration(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether user can download given exploration.
                If a user is authorized to play given exploration, they can download it.
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_view_any_topic_editor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_view_any_topic_editor(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can view any topic editor.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_save_exploration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_save_exploration(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether user can save exploration.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_view_exploration_stats has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_view_exploration_stats(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether user can view exploration stats.
                If a user is authorized to play given exploration, they can view its stats.
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_edit_collection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_edit_collection(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can edit collection.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_play_exploration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_play_exploration(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether user can play given exploration.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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 can_edit_question has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def can_edit_question(
                handler: Callable[..., _GenericHandlerFunctionReturnType]
            ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                """Decorator to check whether the user can edit given question.
            
            
            Severity: Minor
            Found in core/controllers/acl_decorators.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

            Avoid too many return statements within this function.
            Open

                        return decorator(handler)(self, target_id, suggestion_id, **kwargs)
            Severity: Major
            Found in core/controllers/acl_decorators.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return handler(self, topic.name, subtopic_id, **kwargs)
              Severity: Major
              Found in core/controllers/acl_decorators.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return handler(self, story_id, *args, **kwargs)
                Severity: Major
                Found in core/controllers/acl_decorators.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return handler(self, story_id, *args, **kwargs)
                  Severity: Major
                  Found in core/controllers/acl_decorators.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return None
                    Severity: Major
                    Found in core/controllers/acl_decorators.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return None
                      Severity: Major
                      Found in core/controllers/acl_decorators.py - About 30 mins to fix

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

                        def can_resubmit_suggestion(
                            handler: Callable[..., _GenericHandlerFunctionReturnType]
                        ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                            """Decorator to check whether a user can resubmit a suggestion."""
                        
                        
                        Severity: Minor
                        Found in core/controllers/acl_decorators.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

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

                        def can_view_skills(
                            handler: Callable[..., _GenericHandlerFunctionReturnType]
                        ) -> Callable[..., _GenericHandlerFunctionReturnType]:
                            """Decorator to check whether user can view multiple given skills.
                        
                        
                        Severity: Minor
                        Found in core/controllers/acl_decorators.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