Showing 666 of 1,371 total issues
Function ChallengeCreateCtrl
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ChallengeCreateCtrl(utilities, loaderService, $rootScope, $state) {
var vm = this;
var userKey = utilities.getData('userKey');
vm.hostTeamId = utilities.getData('challengeHostTeamId');
vm.wrnMsg = {};
Function togglePhaseVisibility
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
togglePhaseVisibility() {
const SELF = this;
let togglePhaseVisibilityState, isPublic;
if (SELF.phaseVisibility.state === 'Public') {
togglePhaseVisibilityState = 'private';
Function scale_resources_by_challenge_pk
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def scale_resources_by_challenge_pk(request, challenge_pk):
"""
The function called by a host to update the resources used by their challenge.
Calls the scale_resources method. Before calling, checks if the caller hosts the challenge and provided valid CPU
- 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 onSuccess
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function(response) {
var details = response.data;
for (var i = 0; i < details.results.length; i++) {
vm.submissionVisibility[details.results[i].id] = details.results[i].is_public;
File utils.py
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import json
import logging
import os
import re
Function fetchSubmissions
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchSubmissions(challenge, phase) {
const SELF = this;
let API_PATH;
if (SELF.filterSubmissionsQuery === '') {
API_PATH = SELF.endpointsService.allChallengeSubmissionURL(challenge, phase);
File challenge.service.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { NGXLogger } from 'ngx-logger';
import { Router } from '@angular/router';
File challenge.component.spec.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderStaticComponent } from '../../components/nav/header-static/header-static.component';
import { ChallengeComponent } from './challenge.component';
import { ApiService } from '../../services/api.service';
import { GlobalService } from '../../services/global.service';
Function update_leaderboard_data
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update_leaderboard_data(request, leaderboard_data_pk):
"""API endpoint to update a metric in leaderboard data
Arguments:
request {HttpRequest} -- The 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
Function request_challenge_approval_by_pk
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def request_challenge_approval_by_pk(request, challenge_pk):
"""
Checks if all challenge phases have finished submissions for the given challenge
and send approval request for the challenge
"""
- 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
File views.py
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.contrib.auth.models import User
from rest_framework import permissions, status
from rest_framework.decorators import (
api_view,
Function confirmDelete
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
vm.confirmDelete = function(ev, participantTeamId) {
ev.stopPropagation();
// Appending dialog to document.body to cover sidenav in docs app
var confirm = $mdDialog.confirm()
.title('Would you like to remove yourself?')
Function onSuccess
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function(response) {
var details = response.data;
vm.submissionResult = details;
if (Array.isArray(vm.submissionResult.results)) {
Function onSuccess
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function(response) {
var details = response.data;
vm.leaderboard = details.results;
for (var i=0; i<vm.leaderboard.length; i++) {
var dateTimeNow = moment(new Date());
Function MainCtrl
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MainCtrl(utilities, $rootScope, $state) {
var vm = this;
vm.user = {};
vm.challengeList = [];
Function onSuccess
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccess: function(response) {
var details = response.data;
vm.leaderboard = details.results;
// setting last_submission time
Function confirmDelete
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
vm.confirmDelete = function(ev, hostTeamId) {
ev.stopPropagation();
// Appending dialog to document.body to cover sidenav in docs app
var confirm = $mdDialog.confirm()
.title('Would you like to remove yourself?')
Function createNewTeam
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
vm.createNewTeam = function() {
vm.isExistLoader = true;
vm.loaderTitle = '';
vm.startLoader("Loading Teams");
Function send_submission_message
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def send_submission_message(request, challenge_phase_pk, submission_pk):
"""
API to send a submisison message to the challenge specific SQS queue
Arguments:
- 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 make_request
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def make_request(url, method, data=None):
headers = get_request_headers()
if method == "GET":
try:
response = requests.get(url=url, headers=headers)
- 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"