flxwu/contest.io

View on GitHub

Showing 26 of 210 total issues

Avoid too many return statements within this function.
Open

            return json.dumps(content), HTTPStatus.BAD_REQUEST, {'ContentType':'application/json'}
Severity: Major
Found in server/__init__.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return None
Severity: Major
Found in server/__init__.py - About 30 mins to fix

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

def api_contest_results():
    user = get_queryparam('user')
    contest = get_queryparam('contest')
    force = get_queryparam('force')
    returnJSON = None
Severity: Minor
Found in server/__init__.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 api_usergroup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def api_usergroup():
    """
    Contest Endpoint: POST with Content-Type = application/json
    {
        "groupname": groupname (String)
Severity: Minor
Found in server/__init__.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 insert_to_database has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def insert_to_database(self, handle: str): # pylint: disable=arguments-differ
        if self.submissions:
            for submission in reversed(self.submissions):
                verdict,time = submission['verdict'], submission['creationTimeSeconds']
                user = models.get_userid(handle)
Severity: Minor
Found in server/api/api_connector.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 api_contests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def api_contests():
    if request.method == 'GET':
        if get_queryparam('visible'):
            # get all visible contests
            contests = models.select_contest(
Severity: Minor
Found in server/__init__.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