File gae_models.py
has 3015 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Function get_in_review_translation_suggestions_with_exp_ids_by_offset
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def get_in_review_translation_suggestions_with_exp_ids_by_offset(
cls,
limit: Optional[int],
offset: int,
user_id: str,
- Read upRead up
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 get_in_review_translation_suggestions_by_offset
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def get_in_review_translation_suggestions_by_offset(
cls,
limit: Optional[int],
offset: int,
user_id: str,
- Read upRead up
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 get_in_review_question_suggestions_by_offset
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get_in_review_question_suggestions_by_offset(
cls,
limit: int,
offset: int,
user_id: str,
- Read upRead up
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
GeneralSuggestionModel
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class GeneralSuggestionModel(base_models.BaseModel):
"""Model to store suggestions made by Oppia users.
The ID of the suggestions created is the same as the ID of the thread
linked to the suggestion.
Function fetch_page
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def fetch_page(
cls,
page_size: int,
offset: int,
sort_by: Optional[SortChoices.value],
- Read upRead up
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 fetch_page
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def fetch_page(
cls,
page_size: int,
offset: int,
language_code: str,
- Read upRead up
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 fetch_page
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def fetch_page(
cls,
page_size: int,
offset: int,
sort_by: Optional[SortChoices.value],
- Read upRead up
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 fetch_page
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def fetch_page(
cls,
page_size: int,
offset: int,
language_code: str,
- Read upRead up
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 create
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Function create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(
Avoid deeply nested control flow statements. Open
if len(sorted_results) == page_size:
break
else:
Function get_in_review_translation_suggestions_with_exp_ids_by_offset
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_in_review_translation_suggestions_with_exp_ids_by_offset(
Avoid deeply nested control flow statements. Open
if len(sorted_results) == page_size:
break
else:
Avoid deeply nested control flow statements. Open
if suggestion_model.author_id != user_id:
sorted_results.append(suggestion_model)
if len(sorted_results) == limit:
break
Avoid deeply nested control flow statements. Open
if len(sorted_results) == page_size:
break
else:
Function fetch_page
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch_page(
Avoid deeply nested control flow statements. Open
if len(sorted_results) == page_size:
break
else:
Avoid deeply nested control flow statements. Open
if suggestion_model.author_id != user_id:
sorted_results.append(suggestion_model)
if len(sorted_results) == limit:
break
Function get_in_review_question_suggestions_by_offset
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_in_review_question_suggestions_by_offset(
Function get_user_created_suggestions_by_offset
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_user_created_suggestions_by_offset(
Function get_in_review_translation_suggestions_by_offset
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_in_review_translation_suggestions_by_offset(
Function fetch_page
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch_page(
Function fetch_page
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch_page(