Showing 666 of 1,371 total issues
Avoid deeply nested control flow statements. Open
Open
if (vm.existTeam.previous === null) {
vm.isPrev = 'disabled';
} else {
vm.isPrev = '';
}
Function runFunc
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function runFunc($rootScope, $state, utilities, $window, $location, toaster) {
Function scale_up_workers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def scale_up_workers(challenge, original_desired_size, pending_submissions, evalai_interface, aws_keys, new_desired_size):
Avoid deeply nested control flow statements. Open
Open
else if (duration._data.hours !=0) {
var hours = duration.asHours();
vm.leaderboard[i].submission__submitted_at = hours;
if (hours.toFixed(0)==1) {
vm.leaderboard[i].timeSpan = 'hour';
Avoid deeply nested control flow statements. Open
Open
for(var i=0; i<challengePhaseId.length; i++) {
if (challengePhaseId[i] == response.data.challenge_phase) {
vm.lastSubmissionTime[challengePhaseId[i]] = details.last_submission_timestamp_in_challenge_phase;
i++;
break;
Avoid deeply nested control flow statements. Open
Open
if (days.toFixed(0)==1) {
vm.leaderboard[i].timeSpan = 'day';
} else {
vm.leaderboard[i].timeSpan = 'days';
}
Avoid deeply nested control flow statements. Open
Open
if (days.toFixed(0) == 1) {
vm.leaderboard[i].timeSpan = 'day';
} else {
vm.leaderboard[i].timeSpan = 'days';
}
Function scale_up_or_down_workers_for_challenge
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def scale_up_or_down_workers_for_challenge(challenge, challenge_metrics):
if ENV == "prod":
try:
if challenge["remote_evaluation"] is False:
scale_up_or_down_workers(challenge, challenge_metrics)
- 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 profileCtrl
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function profileCtrl(utilities, $rootScope, $scope, $mdDialog, moment, $state) {
Avoid deeply nested control flow statements. Open
Open
else if (duration._data.hours !=0) {
var hours = duration.asHours();
vm.leaderboard[i].submission__submitted_at = hours;
if (hours.toFixed(0)==1) {
vm.leaderboard[i].timeSpan = 'hour';
Avoid deeply nested control flow statements. Open
Open
} else if (duration._data.hours != 0) {
var hours = duration.asHours();
vm.leaderboard[i].submission__submitted_at = hours;
if (hours.toFixed(0) == 1) {
vm.leaderboard[i].timeSpan = 'hour';
Avoid deeply nested control flow statements. Open
Open
for(var i=0; i<challengePhaseId.length; i++) {
if (challengePhaseId[i] == details.challenge_phase) {
vm.totalSubmission[challengePhaseId[i]] = details.total_submissions;
vm.totalParticipatedTeams[challengePhaseId[i]] = details.participant_team_count;
i++;
Avoid deeply nested control flow statements. Open
Open
if pods_list and pods_list.items[0].status.container_statuses:
# Update submission to running
submission_data = {
"submission_status": "running",
"submission": submission_pk,
Avoid deeply nested control flow statements. Open
Open
if job_name:
latest_job_name = job_name[-1]
delete_job(api_instance, latest_job_name)
else:
logger.info(
Avoid deeply nested control flow statements. Open
Open
if metric not in leaderboard_metrics:
missing_metrics.append(metric)
Avoid deeply nested control flow statements. Open
Open
for domain in challenge.allowed_email_domains:
domains = "{}{}{}".format(domains, "/", domain)
domains = domains[1:]
Avoid deeply nested control flow statements. Open
Open
if metric not in leaderboard_metrics:
missing_metrics.append(metric)
Avoid deeply nested control flow statements. Open
Open
if not (
isinstance(value, float) or isinstance(value, int)
):
malformed_metrics.append((metric, type(value)))
Avoid deeply nested control flow statements. Open
Open
if container_name in ["agent", "submission", "environment"]:
if container_state.terminated is not None:
pod_name = pods_list.items[0].metadata.name
try:
pod_log_response = core_v1_api_instance.read_namespaced_pod_log(
Avoid deeply nested control flow statements. Open
Open
if (
current_running_submissions_count
== maximum_concurrent_submissions
):
pass