Cloud-CV/EvalAI

View on GitHub
frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts

Summary

Maintainability
F
1 wk
Test Coverage

File challengeviewallsubmissions.component.ts has 454 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, OnInit, QueryList, ViewChildren, AfterViewInit } from '@angular/core';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Router, ActivatedRoute } from '@angular/router';
import { NGXLogger } from 'ngx-logger';

    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);

      Function cancelSubmission has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        cancelSubmission(submission) {
          const SELF = this;
          if (submission.status != "submitted") {
            SELF.globalService.showToast('error', 'Only unproccessed submissions can be cancelled', 5);
            return;

        Function loadPaginationData has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          loadPaginationData(url) {
            if (url !== null) {
              const SELF = this;
              const API_PATH = url.split(environment.api_endpoint)[1];
              SELF.apiService.getUrl(API_PATH, true).subscribe(

          Function ngOnInit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            ngOnInit() {
              if (this.authService.isLoggedIn()) {
                this.isLoggedIn = true;
              }
              this.routerPublic = this.router;

            Function downloadSubmission has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              downloadSubmission() {
                if (this.challenge['id'] && this.selectedPhase && this.fileSelected) {
                  const API_PATH = this.endpointsService.challengeSubmissionDownloadURL(
                    this.challenge['id'],
                    this.selectedPhase['id'],

              Function downloadSubmission has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                downloadSubmission() {
                  if (this.challenge['id'] && this.selectedPhase && this.fileSelected) {
                    const API_PATH = this.endpointsService.challengeSubmissionDownloadURL(
                      this.challenge['id'],
                      this.selectedPhase['id'],

              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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                cancelSubmission(submission) {
                  const SELF = this;
                  if (submission.status != "submitted") {
                    SELF.globalService.showToast('error', 'Only unproccessed submissions can be cancelled', 5);
                    return;
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 598..638

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 284.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  this.challengeService.currentParticipationStatus.subscribe((status) => {
                    this.isParticipated = status;
                    if (!status) {
                      this.globalService.storeData(this.globalService.redirectStorageKey, { path: this.routerPublic.url });
                      let redirectToPath = '';
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 216..230

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 234.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                  this.challengeService.currentPhases.subscribe((phases) => {
                    this.phases = phases;
                    for (let i = 0; i < this.phases.length; i++) {
                      if (this.phases[i].is_public === false) {
                        this.phases[i].showPrivate = true;
              frontend_v2/src/app/components/challenge/challengesettings/challengesettings.component.ts on lines 252..262
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 231..241

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 147.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                        if (data.next === null) {
                          SELF.paginationDetails.isNext = 'disabled';
                          SELF.paginationDetails.currentPage = Math.ceil(data.count / 100);
                        } else {
                          SELF.paginationDetails.isNext = '';
              frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 314..324

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 136.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                        if (data.next === null) {
                          SELF.paginationDetails.isNext = 'disabled';
                          SELF.paginationDetails.currentPage = 1;
                        } else {
                          SELF.paginationDetails.isNext = '';
              frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 397..407

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 136.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                updateSubmissionVisibility(id) {
                  for (let i = 0; i < this.submissions.length; i++) {
                    if (this.submissions[i]['id'] === id) {
                      this.submissions[i]['is_public'] = !this.submissions[i]['is_public'];
                      break;
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 404..411
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 446..453
              frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 448..455

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 101.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                updateSubmissionFlag(id) {
                  for (let i = 0; i < this.submissions.length; i++) {
                    if (this.submissions[i]['id'] === id) {
                      this.submissions[i]['is_flagged'] = !this.submissions[i]['is_flagged'];
                      break;
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 404..411
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 446..453
              frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 435..442

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 101.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                constructor(
                  private authService: AuthService,
                  private router: Router,
                  private route: ActivatedRoute,
                  private challengeService: ChallengeService,
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 185..195

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              @Component({
                selector: 'app-challengeviewallsubmissions',
                templateUrl: './challengeviewallsubmissions.component.html',
                styleUrls: ['./challengeviewallsubmissions.component.scss'],
                animations: [
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 22..659

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 86.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                        if (data.count === 0) {
                          SELF.paginationDetails.showPagination = false;
                          SELF.paginationDetails.paginationMessage = 'No results found';
                        } else {
                          SELF.paginationDetails.showPagination = true;
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 294..300

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 81.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (this.challenge['id'] && this.selectedPhase && this.fileSelected) {
                    const API_PATH = this.endpointsService.challengeSubmissionDownloadURL(
                      this.challenge['id'],
                      this.selectedPhase['id'],
                      this.fileSelected
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 329..353

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 67.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 4 locations. Consider refactoring.
              Open

                        if (data.previous === null) {
                          SELF.paginationDetails.isPrev = 'disabled';
                        } else {
                          SELF.paginationDetails.isPrev = '';
                        }
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 310..314
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 384..388
              frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 325..329

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 4 locations. Consider refactoring.
              Open

                        if (data.previous === null) {
                          SELF.paginationDetails.isPrev = 'disabled';
                        } else {
                          SELF.paginationDetails.isPrev = '';
                        }
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 310..314
              frontend_v2/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts on lines 384..388
              frontend_v2/src/app/components/challenge/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 415..419

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status