vj4/model/adaptor/contest.py

Summary

Maintainability
D
2 days
Test Coverage

File contest.py has 491 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import collections
import datetime
import functools
import itertools
Severity: Minor
Found in vj4/model/adaptor/contest.py - About 7 hrs to fix

    Function _acm_scoreboard has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def _acm_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
      columns = []
      columns.append({'type': 'rank', 'value': _('Rank')})
      columns.append({'type': 'user', 'value': _('User')})
      columns.append({'type': 'display_name', 'value': _('Display Name')})
    Severity: Minor
    Found in vj4/model/adaptor/contest.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 _assignment_scoreboard has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _assignment_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
      columns = []
      columns.append({'type': 'rank', 'value': _('Rank')})
      columns.append({'type': 'user', 'value': _('User')})
      columns.append({'type': 'display_name', 'value': _('Display Name')})
    Severity: Minor
    Found in vj4/model/adaptor/contest.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 _assignment_stat has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _assignment_stat(tdoc, journal):
      effective = {}
      for j in journal:
        if j['pid'] in tdoc['pids'] and not (j['pid'] in effective and effective[j['pid']]['accept']):
          effective[j['pid']] = j
    Severity: Minor
    Found in vj4/model/adaptor/contest.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 _oi_scoreboard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _oi_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
      columns = []
      columns.append({'type': 'rank', 'value': _('Rank')})
      columns.append({'type': 'user', 'value': _('User')})
      columns.append({'type': 'display_name', 'value': _('Display Name')})
    Severity: Minor
    Found in vj4/model/adaptor/contest.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 _acm_scoreboard has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _acm_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
    Severity: Major
    Found in vj4/model/adaptor/contest.py - About 50 mins to fix

      Function _oi_scoreboard has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _oi_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
      Severity: Major
      Found in vj4/model/adaptor/contest.py - About 50 mins to fix

        Function _assignment_scoreboard has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _assignment_scoreboard(is_export, _, tdoc, ranked_tsdocs, udict, dudict, pdict):
        Severity: Major
        Found in vj4/model/adaptor/contest.py - About 50 mins to fix

          Function _acm_stat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def _acm_stat(tdoc, journal):
            naccept = collections.defaultdict(int)
            effective = {}
            for j in journal:
              if j['pid'] in tdoc['pids'] and not (j['pid'] in effective and effective[j['pid']]['accept']):
          Severity: Minor
          Found in vj4/model/adaptor/contest.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

          There are no issues that match your filters.

          Category
          Status