twschiller/open-synthesis

View on GitHub

Showing 26 of 36 total issues

Avoid too many return statements within this function.
Open

        return "disagree-mild-dispute"
Severity: Major
Found in openach/templatetags/board_extras.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return "disagree-large-dispute"
    Severity: Major
    Found in openach/templatetags/board_extras.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return "disagree-consensus"
      Severity: Major
      Found in openach/templatetags/board_extras.py - About 30 mins to fix

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

        def edit_team(request, team_id):
            """Return a team edit view, or handle the form submission."""
            # TODO: if user turns off invitation-required, let everyone in who had outstanding membership requests
        
            team = get_object_or_404(Team, pk=team_id)
        Severity: Minor
        Found in openach/views/teams.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 add_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def add_source(request, evidence_id):
            """Return a view for adding a corroborating/contradicting source, or handle form submission."""
            evidence = get_object_or_404(Evidence, pk=evidence_id)
            if request.method == "POST":
                form = EvidenceSourceForm(request.POST)
        Severity: Minor
        Found in openach/views/evidence.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 calc_disagreement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def calc_disagreement(evaluations):
            """Return the disagreement level for evaluations, or None if no evaluations.
        
            Calculated as the max disagreement of (1) N/A and non-N/A responses and (2) non-N/A evaluations
            :param evaluations: an iterable of Eval
        Severity: Minor
        Found in openach/metrics.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