Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

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

    try:
        challenge = Challenge.objects.get(pk=challenge_id)
    except Challenge.DoesNotExist:
        response_data = {"error": "Challenge does not exist"}
        return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
Severity: Major
Found in apps/jobs/views.py and 11 other locations - About 1 hr to fix
apps/hosts/views.py on lines 75..79
apps/hosts/views.py on lines 117..123
apps/hosts/views.py on lines 165..171
apps/hosts/views.py on lines 268..272
apps/hosts/views.py on lines 275..281
apps/jobs/views.py on lines 235..243
apps/jobs/views.py on lines 438..442
apps/jobs/views.py on lines 2595..2599
apps/jobs/views.py on lines 2768..2772
apps/jobs/views.py on lines 2884..2888
apps/jobs/views.py on lines 2925..2931

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

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

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

        vm.editChallengeDate = function(editChallengeDateForm) {
            if (editChallengeDateForm) {
                var challengeHostList = utilities.getData("challengeCreator");
                for (var challenge in challengeHostList) {
                    if (challenge == vm.challengeId) {
Severity: Minor
Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

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

      editPhaseDetailsUpload() {
        const SELF = this;
        SELF.apiCall = (params) => {
          const FORM_DATA: FormData = new FormData();
          FORM_DATA.append('phase_description_file', params['phase_description_file']);

      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 ChallengeCtrl has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function ChallengeCtrl(utilities, loaderService, $scope, $state, $http, $stateParams, $rootScope, $interval, $mdDialog, moment, $location, $anchorScroll, $timeout) {
        Severity: Major
        Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

          Function onSuccess has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                              onSuccess: function (response) {
                                  vm.phaseRemainingSubmissions = response.data;
                                  var details = vm.phaseRemainingSubmissions.phases;
                                  for (var i = 0; i < details.length; i++) {
                                      if (details[i].limits.submission_limit_exceeded === true) {
          Severity: Minor
          Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

            Function editEvalScript has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    vm.editEvalScript = function(editEvaluationCriteriaForm) {
                        if (editEvaluationCriteriaForm) {
                            if (vm.editEvaluationScript === undefined || vm.editEvaluationScript === null
                                 || vm.editEvaluationScript === "") {
                                var error = "Please upload a valid evaluation script!";
            Severity: Minor
            Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

              Function toggleParticipation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      vm.toggleParticipation = function (ev, isRegistrationOpen) {
                          // ev.stopPropagation();
                          var participationState;
                          var participationModalText;
                          if (isRegistrationOpen) {
              Severity: Minor
              Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

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

                        vm.getAuthTokenDialog = function(ev) {
                            vm.titleInput = "";
                            $mdDialog.show({
                                scope: $scope,
                                preserveScope: true,
                Severity: Major
                Found in frontend/src/js/controllers/profileCtrl.js and 1 other location - About 1 hr to fix
                frontend/src/js/controllers/challengeCtrl.js on lines 2471..2480

                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

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

                        vm.deleteChallengeDialog = function(ev) {
                            vm.titleInput = "";
                            $mdDialog.show({
                                scope: $scope,
                                preserveScope: true,
                Severity: Major
                Found in frontend/src/js/controllers/challengeCtrl.js and 1 other location - About 1 hr to fix
                frontend/src/js/controllers/profileCtrl.js on lines 126..135

                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

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

                  beforeEach(async(() => {
                    TestBed.configureTestingModule({
                      declarations: [HomemainComponent],
                      providers: [GlobalService, AuthService, ApiService, EndpointsService],
                      imports: [RouterTestingModule, HttpClientModule],
                frontend_v2/src/app/components/publiclists/teamlist/teamcard/teamcard.component.spec.ts on lines 17..24

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

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

                const routes: Routes = [
                  { path: 'challenge/:id/participate', component: ChallengeparticipateComponent },
                  { path: 'challenge/:id/submit', component: ChallengesubmitComponent },
                  {
                    path: '404',
                frontend_v2/src/app/components/profile/profile.component.spec.ts on lines 19..37

                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

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

                const routes: Routes = [
                  {
                    path: '',
                    component: ProfileComponent,
                  },
                frontend_v2/src/app/components/challenge/challengesubmit/challengesubmit.component.spec.ts on lines 16..28

                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 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/challengeviewallsubmissions/challengeviewallsubmissions.component.ts on lines 355..381

                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

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

                  beforeEach(async(() => {
                    TestBed.configureTestingModule({
                      declarations: [TeamcardComponent],
                      providers: [GlobalService, ApiService, AuthService, EndpointsService],
                      imports: [RouterTestingModule, HttpClientModule],
                frontend_v2/src/app/components/home/homemain/homemain.component.spec.ts on lines 16..23

                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

                Function get_or_create_sqs_queue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_or_create_sqs_queue(queue_name, challenge=None):
                    """
                    Returns:
                        Returns the SQS Queue object
                    """
                Severity: Minor
                Found in scripts/workers/submission_worker.py - About 1 hr to fix

                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 remove_participant_team_from_approved_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def remove_participant_team_from_approved_list(request, challenge_pk, participant_team_pk):
                    """
                    Remove participant team from approved list
                    """
                    try:
                Severity: Minor
                Found in apps/challenges/views.py - About 1 hr to fix

                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 restart_workers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def restart_workers(queryset):
                    """
                    The function called by the admin action method to restart all the selected workers.
                
                    Calls the service_manager method. Before calling, verifies that the challenge worker(s) is(are) active.
                Severity: Minor
                Found in apps/challenges/aws_utils.py - About 1 hr to fix

                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 finish_annotation_file_upload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def finish_annotation_file_upload(request, challenge_phase_pk):
                    """
                    API to complete multipart upload for a test annotation file
                
                    Arguments:
                Severity: Minor
                Found in apps/challenges/views.py - About 1 hr to fix

                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

                Severity
                Category
                Status
                Source
                Language