ejplatform/ej-server

View on GitHub
src/ej_clusters/views.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function stereotype_votes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def stereotype_votes(request, conversation_id, **kwargs):
    conversation = Conversation.objects.get(id=conversation_id)
    clusterization = conversation.get_clusterization(default=None)
    created_vote_id = None
    if clusterization is None:
Severity: Minor
Found in src/ej_clusters/views.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 ctrl has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def ctrl(request, conversation_id, slug, board_slug, check=check_promoted):
Severity: Minor
Found in src/ej_clusters/views.py - About 35 mins to fix

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

    def get_json_shape_user_group_from_clusterization(clusterization, user):
        user_group = None
        if clusterization is None:
            clusters = ()
            shapes_json = None
    Severity: Minor
    Found in src/ej_clusters/views.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 post_edit_view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def post_edit_view(request, conversation, clusters):
        new_cluster_form = forms.ClusterFormNew(request=request, user=conversation.author)
        edit_cluster = None
        show_modal = False
        CREATED_GROUP = "created_group_modal"
    Severity: Minor
    Found in src/ej_clusters/views.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