Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

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

                onSuccess: function(response) {
                    var details = response.data;
                    vm.leaderboard = details.results;
                    for (var j=0; j<vm.showPrivateIds.length; j++) {
                        if (vm.showPrivateIds[j] == vm.phaseSplitId) {
Severity: Major
Found in frontend/src/js/controllers/challengeCtrl.js - About 3 hrs to fix

    File directives.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // define directives here
    (function() {
        'use strict';
        // dynamic header directive
        angular
    Severity: Minor
    Found in frontend/src/js/directives/directives.js - About 3 hrs to fix

      Function register_task_def_by_challenge_pk has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      def register_task_def_by_challenge_pk(client, queue_name, challenge):
          """
          Registers the task definition of the worker for a challenge, before creating a service.
      
          Parameters:
      Severity: Minor
      Found in apps/challenges/aws_utils.py - About 3 hrs 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 validateInput has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        validateInput(e) {
          this.isDirty = true;
          this.value = e;
          e === '' ? (this.isEmpty = true) : (this.isEmpty = false);
          if (e === '' && this.isRequired) {
      Severity: Minor
      Found in frontend_v2/src/app/components/utility/input/input.component.ts - About 3 hrs 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

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

          def __init__(self, *args, **kwargs):
              super(InviteParticipantToTeamSerializer, self).__init__(
                  *args, **kwargs
              )
              context = kwargs.get("context")
      Severity: Major
      Found in apps/participants/serializers.py and 1 other location - About 3 hrs to fix
      apps/hosts/serializers.py on lines 54..59

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

      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

          def __init__(self, *args, **kwargs):
              super(InviteHostToTeamSerializer, self).__init__(*args, **kwargs)
              context = kwargs.get("context")
              if context:
                  self.challenge_host_team = context.get("challenge_host_team")
      Severity: Major
      Found in apps/hosts/serializers.py and 1 other location - About 3 hrs to fix
      apps/participants/serializers.py on lines 37..44

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

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

                  onSuccess: function(response) {
                      var status = response.status;
                      var details = response.data;
                      if (status == 200) {
                          vm.existTeam = details;
      Severity: Major
      Found in frontend/src/js/controllers/teamsCtrl.js - About 3 hrs to fix

        Function ChallengeListCtrl has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function ChallengeListCtrl(utilities, $window, moment) {
                var vm = this;
                var userKey = utilities.getData('userKey');
                var gmtOffset = moment().utcOffset();
                var gmtSign = gmtOffset >= 0 ? '+' : '-';
        Severity: Major
        Found in frontend/src/js/controllers/challengeListCtrl.js - About 3 hrs to fix

          ChallengeleaderboardComponent has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

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

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

                def validate_email(self, value):
                    if value == self.user.email:
                        raise serializers.ValidationError("A host cannot invite himself")
                    try:
                        User.objects.get(email=value)
            Severity: Major
            Found in apps/hosts/serializers.py and 1 other location - About 3 hrs to fix
            apps/participants/serializers.py on lines 46..55

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

            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

                def validate_email(self, value):
                    if value == self.user.email:
                        raise serializers.ValidationError(
                            "A participant cannot invite himself"
                        )
            Severity: Major
            Found in apps/participants/serializers.py and 1 other location - About 3 hrs to fix
            apps/hosts/serializers.py on lines 61..68

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

            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(() => {
                router = TestBed.get(Router);
                authService = TestBed.get(AuthService);
                apiService = TestBed.get(ApiService);
                globalService = TestBed.get(GlobalService);
            frontend_v2/src/app/components/publiclists/challengelist/challengelist.component.spec.ts on lines 57..64

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

            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(() => {
                router = TestBed.get(Router);
                fixture = TestBed.createComponent(ChallengelistComponent);
                authService = TestBed.get(AuthService);
                globalService = TestBed.get(GlobalService);
            frontend_v2/src/app/components/contact/contact.component.spec.ts on lines 57..64

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

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

              updateUserDetails() {
                const firstName = this.user['first_name'] === '-' ? '' : this.user['first_name'];
                const lastName = this.user['last_name'] === '-' ? '' : this.user['last_name'];
                const affiliation = this.user['affiliation'] === '-' ? '' : this.user['affiliation'];
                const googleScholarUrl = this.user['google_scholar_url'] === '-' ? '' : this.user['google_scholar_url'];
            Severity: Major
            Found in frontend_v2/src/app/components/profile/profile.component.ts - About 3 hrs to fix

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

                          if (vm.filter_all_submission_by_team_name === '') {
                              parameters.url = "challenges/" + vm.challengeId + "/challenge_phase/" +
                              vm.phaseId + "/submissions";
                          } else {
                              parameters.url = "challenges/" + vm.challengeId + "/challenge_phase/" +
              Severity: Major
              Found in frontend/src/js/controllers/challengeCtrl.js and 1 other location - About 3 hrs to fix
              frontend/src/js/controllers/challengeCtrl.js on lines 1300..1306

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

              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 (vm.filter_my_submission_by_team_name === '') {
                              parameters.url = "jobs/challenge/" + vm.challengeId + "/challenge_phase/" +
                              vm.phaseId + "/submission/";
                          } else {
                              parameters.url = "jobs/challenge/" + vm.challengeId + "/challenge_phase/" +
              Severity: Major
              Found in frontend/src/js/controllers/challengeCtrl.js and 1 other location - About 3 hrs to fix
              frontend/src/js/controllers/challengeCtrl.js on lines 1802..1808

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

              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 (DIFF_HOURS < 1) {
                      const DIFF_MINUTES = DIFF_HOURS * 60;
                      if (DIFF_MINUTES < 1) {
                        const DIFF_SECONDS = DIFF_MINUTES * 60;
                        return Math.floor(DIFF_SECONDS) + ' seconds';
              Severity: Major
              Found in frontend_v2/src/app/services/global.service.ts and 1 other location - About 3 hrs to fix
              frontend_v2/src/app/services/global.service.ts on lines 516..526

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

              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 (DIFF_DAYS > 100) {
                      const DIFF_WEEKS = DIFF_DAYS / 7;
                      if (DIFF_WEEKS > 104) {
                        const DIFF_YEARS = DIFF_WEEKS / 52;
                        return Math.floor(DIFF_YEARS) + ' year(s)';
              Severity: Major
              Found in frontend_v2/src/app/services/global.service.ts and 1 other location - About 3 hrs to fix
              frontend_v2/src/app/services/global.service.ts on lines 504..514

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

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

              def finish_submission_file_upload(request, challenge_phase_pk, submission_pk):
                  """
                  API to complete multipart upload of presigned url submission
              
                  Arguments:
              Severity: Minor
              Found in apps/jobs/views.py - About 3 hrs 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

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

                highlightSectionTitle(el) {
                  const ALL_TARGETS = this.document.getElementsByClassName('privacy-section-title');
                  [].forEach.call(ALL_TARGETS, function (item) {
                    item.classList.remove('scroll-selected');
                    if (item.id === el) {
              frontend_v2/src/app/components/privacy-policy/privacy-policy.component.ts on lines 41..49

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

              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