Cloud-CV/EvalAI

View on GitHub
frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts

Summary

Maintainability
F
4 days
Test Coverage

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

import { Component, OnInit, ViewChildren, QueryList, OnDestroy } from '@angular/core';
import { ApiService } from '../../../services/api.service';
import { GlobalService } from '../../../services/global.service';
import { AuthService } from '../../../services/auth.service';
import { Router, ActivatedRoute } from '@angular/router';

    TeamlistComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      selector: 'app-teamlist',
      templateUrl: './teamlist.component.html',
      styleUrls: ['./teamlist.component.scss'],
    })

      Function editTeamWrapper has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        editTeamWrapper() {
          const SELF = this;
          let TeamUrl;
          const editTeam = (team) => {
            const teamId = team['id'];

        Function editTeam has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const editTeam = (team) => {
              const teamId = team['id'];
              const teamName = team['team_name'];
              const teamUrl = team['team_url'];
              TeamUrl = this.isHost

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

            ngOnInit() {
              this.routerPublic = this.router;
          
              if (!this.authService.isLoggedIn()) {
                this.router.navigate([this.authRoutePath]);

            Function addMembersToTeamWrapper has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              addMembersToTeamWrapper() {
                const SELF = this;
                const addMembersToTeam = (team) => {
                  SELF.apiCall = (params) => {
                    const BODY = JSON.stringify(params);

              Function addMembersToTeam has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const addMembersToTeam = (team) => {
                    SELF.apiCall = (params) => {
                      const BODY = JSON.stringify(params);
                      let apiPath = SELF.endpointsService.participantTeamInviteURL(team);
                      if (SELF.isHost) {

                Function createTeamSubmit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  createTeamSubmit(isvalidForm) {
                    if (isvalidForm) {
                      const API_PATH = this.createTeamsPath;
                      const url = this.create_team['team_url'];
                      let TEAM_BODY: any = {

                  Function ngOnInit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    ngOnInit() {
                      this.routerPublic = this.router;
                  
                      if (!this.authService.isLoggedIn()) {
                        this.router.navigate([this.authRoutePath]);

                  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 deleteTeamMemberWrapper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    deleteTeamMemberWrapper() {
                      const SELF = this;
                      const deleteTeamMember = (team) => {
                        const deleteUrl = SELF.deleteMembersPath.replace('<team_id>', team.teamId);
                        SELF.apiCall = (params) => {

                    Function deleteTeamWrapper has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      deleteTeamWrapper() {
                        const SELF = this;
                        const deleteTeam = (e) => {
                          SELF.apiCall = () => {
                            SELF.apiService.deleteUrl(SELF.deleteTeamsPath + '/' + e).subscribe(

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

                        updateTeamsView(reset) {
                          if (reset) {
                            this.seeMore = 1;
                          }
                          this.filteredTeams = this.allTeams.slice((this.seeMore - 1) * this.windowSize, this.seeMore * this.windowSize);
                      frontend_v2/src/app/components/challenge/challengeparticipate/challengeparticipate.component.ts on lines 238..244

                      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 102.

                      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 3 locations. Consider refactoring.
                      Open

                              SELF.apiService.deleteUrl(deleteUrl + team.participantId).subscribe(
                                (data) => {
                                  // Success Message in data.message
                                  SELF.globalService.showToast('success', 'Member was removed from the team!', 5);
                                  SELF.fetchMyTeams(SELF.fetchTeamsPath);
                      frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts on lines 428..439
                      frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts on lines 469..480

                      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

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

                              SELF.apiService.deleteUrl(SELF.deleteTeamsPath + '/' + e).subscribe(
                                (data) => {
                                  // Success Message in data.message
                                  SELF.globalService.showToast('success', 'You were removed from the team!', 5);
                                  SELF.fetchMyTeams(SELF.fetchTeamsPath);
                      frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts on lines 469..480
                      frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts on lines 631..642

                      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

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

                              SELF.apiService.patchUrl(TeamUrl, BODY).subscribe(
                                (data) => {
                                  // Success Message in data.message
                                  SELF.globalService.showToast('success', 'Team Updated', 5);
                                  SELF.fetchMyTeams(SELF.fetchTeamsPath);
                      frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts on lines 428..439
                      frontend_v2/src/app/components/publiclists/teamlist/teamlist.component.ts on lines 631..642

                      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

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

                        constructor(
                          private apiService: ApiService,
                          private authService: AuthService,
                          private globalService: GlobalService,
                          private router: Router,
                      frontend_v2/src/app/components/challenge/challengeparticipate/challengeparticipate.component.ts on lines 148..156
                      frontend_v2/src/app/components/profile/profile.component.ts on lines 74..82

                      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 75.

                      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

                            (err) => {
                              if (err.status === 403) {
                                this.router.navigate(['permission-denied']);
                              }
                              this.globalService.stopLoader();
                      frontend_v2/src/app/components/challenge/challengeparticipate/challengeparticipate.component.ts on lines 199..205

                      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 69.

                      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

                              (err) => {
                                this.globalService.stopLoader();
                                this.globalService.showToast('error', err.error.team_name, 5);
                                this.globalService.handleFormError(this.components, err);
                              },
                      frontend_v2/src/app/components/challenge/challengeparticipate/challengeparticipate.component.ts on lines 313..317

                      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 66.

                      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

                        termsAndConditionContent = [
                          'Participants can train their models with the released training set' +
                            ', also with other training images as long as they are disjoint with the test set' +
                            '(see <a class="blue-text" href="https://arxiv.org/pdf/1804.09691.pdf" target="_blank">arXiv paper</a>)',
                      
                      
                      frontend_v2/src/app/components/challenge/challengeparticipate/challengeparticipate.component.ts on lines 116..137

                      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 66.

                      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