Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

Function editprofileDialog has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        vm.editprofileDialog = function(ev) {
            switch (ev.currentTarget.id) {
                case "first_name":
                  vm.titleInput = "First Name";
                  vm.editid = "first_name";
Severity: Minor
Found in frontend/src/js/controllers/profileCtrl.js - About 1 hr to fix

    Function logs_poller has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                vm.logs_poller = $interval(function () {
                    if (vm.evaluation_module_error) {
                        vm.workerLogs = [];
                        vm.workerLogs.push(vm.evaluation_module_error);
                    }
    Severity: Minor
    Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

      Function loadingWrapper has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        loadingWrapper(httpCall, isLoader = true) {
          if (isLoader) {
            setTimeout(() => {
              this.globalService.toggleLoading(true);
            }, 100);
      Severity: Minor
      Found in frontend_v2/src/app/services/api.service.ts - About 1 hr to fix

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

          beforeEach(async(() => {
            TestBed.configureTestingModule({
              declarations: [PhasecardComponent],
              providers: [GlobalService, ChallengeService, EndpointsService, ApiService, AuthService],
              imports: [RouterTestingModule, HttpClientModule],
        frontend_v2/src/app/components/challenge/challengeevaluation/challengeevaluation.component.spec.ts on lines 18..24
        frontend_v2/src/app/components/challenge/challengeoverview/challengeoverview.component.spec.ts on lines 18..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 61.

        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

          beforeEach(async(() => {
            TestBed.configureTestingModule({
              declarations: [ChallengeoverviewComponent],
              providers: [ChallengeService, ApiService, GlobalService, AuthService, EndpointsService],
              imports: [RouterTestingModule, HttpClientModule],
        frontend_v2/src/app/components/challenge/challengeevaluation/challengeevaluation.component.spec.ts on lines 18..24
        frontend_v2/src/app/components/challenge/challengephases/phasecard/phasecard.component.spec.ts on lines 16..22

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

        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

                } else if (path.includes('present')) {
                  SELF.ongoingChallenges = data['results'];
                } else if (path.includes('past')) {
                  SELF.pastChallenges = data['results'];
                }
        frontend_v2/src/app/components/publiclists/challengelist/challengelist.component.ts on lines 422..426

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

        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

          beforeEach(async(() => {
            TestBed.configureTestingModule({
              declarations: [ChallengeevaluationComponent],
              providers: [ChallengeService, ApiService, GlobalService, AuthService, EndpointsService],
              imports: [RouterTestingModule, HttpClientModule],
        frontend_v2/src/app/components/challenge/challengeoverview/challengeoverview.component.spec.ts on lines 18..24
        frontend_v2/src/app/components/challenge/challengephases/phasecard/phasecard.component.spec.ts on lines 16..22

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

        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

                if (path.endsWith('present/')) {
                  SELF.ongoingChallenges = data['results'];
                } else if (path.endsWith('past/')) {
                  SELF.pastChallenges = data['results'];
                }
        frontend_v2/src/app/components/publiclists/challengelist/challengelist.component.ts on lines 395..399

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

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

        function js() {
            var app = gulp.src('frontend/src/js/app.js')
                .pipe(concat('app.js'))
                .pipe(gulp_if(production, rename({ suffix: '.min' })))
                .pipe(gulp_if(production, uglify({ mangle: false })))
        Severity: Minor
        Found in gulpfile.js - About 1 hr to fix

          Function createTemplateChallenge has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            createTemplateChallenge() {
              if (this.challengeData != null) {
                const FORM_DATA: FormData = new FormData();
                this.challengeData['is_challenge_template'] = true;
                this.challengeData['template_id'] = this.id;

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

            def start_workers(queryset):
                """
                The function called by the admin action method to start all the selected workers.
            
                Calls the service_manager method. Before calling, checks if all the workers are incactive.
            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 get_or_create_sqs_queue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_or_create_sqs_queue(queue_name, challenge=None):
                if settings.DEBUG or settings.TEST:
                    queue_name = "evalai_submission_queue"
                    sqs = boto3.resource(
                        "sqs",
            Severity: Minor
            Found in apps/base/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 save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def save(self, *args, **kwargs):
            
                    if not self.pk:
                        sub_num = Submission.objects.filter(
                            challenge_phase=self.challenge_phase,
            Severity: Minor
            Found in apps/jobs/models.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 stop_workers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def stop_workers(queryset):
                """
                The function called by the admin action method to stop all the selected workers.
            
                Calls the service_manager method. Before calling, verifies that the challenge is not new, and is 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 accept_challenge_invitation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def accept_challenge_invitation(request, invitation_key):
                try:
                    invitation = UserInvitation.objects.get(invitation_key=invitation_key)
                except UserInvitation.DoesNotExist:
                    response_data = {
            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 contact_us has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def contact_us(request):
                user_does_not_exist = False
                try:
                    user = User.objects.get(username=request.user)
                    name = user.username
            Severity: Minor
            Found in apps/web/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 formSubmit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              formSubmit(self) {
                self.submissionError = '';
                let metaValue = true;
                const submissionFile = self.globalService.formItemForLabel(self.components, 'input_file').fileValue;
                const submissionProjectUrl = self.globalService.formValueForLabel(self.components, 'project_url');

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

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

            apps/challenges/migrations/0021_remove_challengephase_dataset_split.py on lines 0..13
            apps/participants/migrations/0003_remove_participant_challenge.py on lines 0..15
            apps/participants/migrations/0005_remove_participantteam_challenge.py on lines 0..13

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

            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

            apps/participants/migrations/0003_remove_participant_challenge.py on lines 0..15
            apps/participants/migrations/0005_remove_participantteam_challenge.py on lines 0..13
            apps/participants/migrations/0012_remove_docker_repository_uri_from_team.py on lines 0..18

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

            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

            Severity
            Category
            Status
            Source
            Language