Showing 1,371 of 1,371 total issues
Avoid deeply nested control flow statements. Open
if serializer.is_valid():
serializer.save()
else:
error_messages = f"leaderboard {data['id']} :{str(serializer.errors)}"
raise RuntimeError()
Function get_all_challenges
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_all_challenges(request, challenge_time, challenge_approved, challenge_published):
"""
Returns the list of all challenges
"""
# make sure that a valid url is requested.
- 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
Avoid deeply nested control flow statements. Open
if serializer.is_valid():
serializer.save()
else:
error_messages = f"challenge phase {data['id']} :{str(serializer.errors)}"
raise RuntimeError()
Avoid deeply nested control flow statements. Open
for email in emails:
user = User.objects.get(email=email)
host = Participant(
user=user,
status=Participant.ACCEPTED,
Function get_logs_from_cloudwatch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_logs_from_cloudwatch(
Function update_challenge_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_challenge_attributes(request):
"""
API to update attributes of the Challenge model
Arguments:
request {dict} -- Request object
- 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
Avoid deeply nested control flow statements. Open
if dataset_split_ids.get(str(data["dataset_split_id"])) is None:
message = (
"Dataset split with id {} doesn't exist.".format(data["dataset_split_id"])
)
response_data = {"error": message}
Avoid deeply nested control flow statements. Open
with open(
test_annotation_file_path, "rb"
) as test_annotation_file:
challenge_test_annotation_file = ContentFile(
test_annotation_file.read(),
Avoid deeply nested control flow statements. Open
if challenge_phase_ids.get(str(data["challenge_phase_id"])) is None:
message = (
"Challenge phase with phase id {} doesn't exist.".format(data["challenge_phase_id"])
)
response_data = {"error": message}
Function get_remaining_submission_for_a_phase
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_remaining_submission_for_a_phase(
user, challenge_phase_pk, challenge_pk
):
"""
Returns the number of remaining submissions that a participant can
- 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 toggleLeaderboardVisibility
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
toggleLeaderboardVisibility() {
const SELF = this;
let toggleLeaderboardVisibilityState, visibility, phaseIsPublic;
for (let i = 0; i < SELF.filteredPhases.length; i++) {
if (SELF.filteredPhases[i]['name'] === SELF.selectedPhaseSplit['challenge_phase_name']) {
- 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
Avoid deeply nested control flow statements. Open
if (e.target.value === this.oldPassword) {
this.inputErrorMessage = 'Old password cannot be same as New Password';
}
Avoid deeply nested control flow statements. Open
} else if (e.target.name === 'new_password2') {
this.retype_newPassword = e.target.value;
if (e.target.value !== this.newPassword) {
this.inputErrorMessage = 'Password do not match';
}
Function validate_challenge_config_util
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_challenge_config_util(
Avoid deeply nested control flow statements. Open
if (!this.invalidFields.find((element) => element === 'LinkedIn')) {
this.invalidFields.push('LinkedIn');
}
Avoid deeply nested control flow statements. Open
if (
"labels" in data["schema"]
and default_order_by
not in data["schema"]["labels"]
):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid deeply nested control flow statements. Open
if attribute_type in valid_attribute_types:
if (
attribute_type == "radio"
or attribute_type == "checkbox"
):
Avoid deeply nested control flow statements. Open
if (
current_leaderboard_config_ids
and int(data["id"])
not in current_leaderboard_config_ids
):
Function filterPhases
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
filterPhases() {
if (this.phases.length > 0 && this.phaseSplits.length > 0) {
for (let i = 0; i < this.phaseSplits.length; i++) {
if (this.phaseSplits[i].visibility !== this.challengePhaseVisibility.public) {
this.phaseSplits[i].showPrivate = true;
- 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"