Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

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

  highlightNav(el) {
    const ALL_NAVS = this.document.getElementsByClassName('privacy-nav');
    [].forEach.call(ALL_NAVS, function (item) {
      item.classList.remove('scroll-selected');
      if (item.id === el) {
frontend_v2/src/app/components/privacy-policy/privacy-policy.component.ts on lines 55..63

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

Function ChangePwdCtrl has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function ChangePwdCtrl(utilities, $state, $rootScope) {
        var vm = this;
        var userKey = utilities.getData('userKey');
        vm.wrnMsg = {};
        vm.isValid = {};
Severity: Major
Found in frontend/src/js/controllers/changePwdCtrl.js - About 2 hrs to fix

    Function updateProfile has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            vm.updateProfile = function(resetconfirmFormValid) {
                if (resetconfirmFormValid) {
                    vm.user.github_url = vm.user.github_url === null ? "" : vm.user.github_url;
                    vm.user.google_scholar_url = vm.user.google_scholar_url === null ? "" : vm.user.google_scholar_url;
                    vm.user.linkedin_url = vm.user.linkedin_url === null ? "" : vm.user.linkedin_url;
    Severity: Major
    Found in frontend/src/js/controllers/updateProfileCtrl.js - About 2 hrs to fix

      Function formSubmit has 73 lines of code (exceeds 25 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');

        Function challenge_approval_callback has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def challenge_approval_callback(sender, instance, field_name, **kwargs):
            """This is to check if a challenge has been approved or disapproved since last time.
        
            On approval of a challenge, it launches a worker on Fargate.
            On disapproval, it scales down the workers to 0, and deletes the challenge's service on Fargate.
        Severity: Minor
        Found in apps/challenges/aws_utils.py - About 2 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 add_sponsors_to_challenge has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def add_sponsors_to_challenge(yaml_file_data, challenge):
            if "sponsors" in yaml_file_data:
                sponsors_data = yaml_file_data['sponsors']
                sponsor_name_set = set()
        
        
        Severity: Minor
        Found in apps/challenges/utils.py - About 2 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 editSubmission has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          editSubmission(submission) {
            const SELF = this;
            SELF.apiCall = (params) => {
              let BODY = JSON.parse(JSON.stringify(params));
              if (this.selectedPhase.submission_meta_attributes !== null && this.selectedPhase.submission_meta_attributes !== undefined) {

        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

            try:
                challenge_metrics = evalai_interface.get_challenge_submission_metrics_by_pk(challenge["id"])
                pending_submissions = get_pending_submission_count(challenge_metrics)
            except Exception as e:  # noqa: F841
                print(
        Severity: Major
        Found in scripts/monitoring/auto_scale_ec2_workers.py and 1 other location - About 2 hrs to fix
        scripts/monitoring/auto_scale_eks_nodes.py on lines 154..164

        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

            try:
                challenge_metrics = staff_evalai_interface.get_challenge_submission_metrics_by_pk(challenge["id"])
                pending_submissions = get_pending_submission_count(challenge_metrics)
            except Exception as e:  # noqa: F841
                print(
        Severity: Major
        Found in scripts/monitoring/auto_scale_eks_nodes.py and 1 other location - About 2 hrs to fix
        scripts/monitoring/auto_scale_ec2_workers.py on lines 76..86

        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

          selectSettingsPhaseSplit(phaseSplit, phaseSelectionType, phaseSelectionListType) {
            this.phaseSelectionType = phaseSelectionType;
            this.phaseSelectionListType = phaseSelectionListType;
            this.selectedPhaseSplit = phaseSplit;
            this.phaseName = phaseSplit.challenge_phase_name;
        frontend_v2/src/app/components/utility/selectphase/selectphase.component.ts on lines 184..192

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 93.

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

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

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

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

        Refactorings

        Further Reading

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

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

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 93.

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

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

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

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

        Refactorings

        Further Reading

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

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

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 93.

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

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

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

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

        Refactorings

        Further Reading

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

          selectPhaseSplit(phaseSplit, phaseSelectionType, phaseSelectionListType) {
            this.phaseSelectionType = phaseSelectionType;
            this.phaseSelectionListType = phaseSelectionListType;
            this.selectedPhaseSplit = phaseSplit;
            this.phaseName = phaseSplit.challenge_phase_name;
        frontend_v2/src/app/components/utility/selectphase/selectphase.component.ts on lines 174..182

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 93.

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

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

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

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

        Refactorings

        Further Reading

        Function contactUsCtrl has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function contactUsCtrl(utilities, loaderService, $state, $rootScope) {
                var vm = this;
                var userKey = utilities.getData('userKey');
                vm.wrnMsg = {};
                vm.isValid = {};
        Severity: Major
        Found in frontend/src/js/controllers/contactUsCtrl.js - About 2 hrs to fix

          Function showChallengeAnalysis has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            showChallengeAnalysis() {
              this.globalService.startLoader('');
              let API_PATH = this.endpointService.teamCountAnalyticsURL(this.challengeId);
              this.apiService.getUrl(API_PATH).subscribe(
                (response) => {

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

                            if leaderboard_data is not None:
                                serializer = CreateLeaderboardDataSerializer(
                                    leaderboard_data,
                                    data=data,
                                    partial=True,
            Severity: Major
            Found in apps/jobs/views.py and 1 other location - About 2 hrs to fix
            apps/jobs/views.py on lines 1219..1236

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

            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

                    sqs = boto3.resource(
                        "sqs",
                        endpoint_url=os.environ.get("AWS_SQS_ENDPOINT", "http://sqs:9324"),
                        region_name=os.environ.get("AWS_DEFAULT_REGION", "us-east-1"),
                        aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", "x"),
            Severity: Major
            Found in apps/base/utils.py and 1 other location - About 2 hrs to fix
            apps/jobs/sender.py on lines 29..34

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

            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

                    sqs = boto3.resource(
                        "sqs",
                        endpoint_url=os.environ.get("AWS_SQS_ENDPOINT", "http://sqs:9324"),
                        region_name=os.environ.get("AWS_DEFAULT_REGION", "us-east-1"),
                        aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", "x"),
            Severity: Major
            Found in apps/jobs/sender.py and 1 other location - About 2 hrs to fix
            apps/base/utils.py on lines 173..178

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

            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 leaderboard_data is not None:
                                serializer = CreateLeaderboardDataSerializer(
                                    leaderboard_data,
                                    data=data,
                                    partial=True,
            Severity: Major
            Found in apps/jobs/views.py and 1 other location - About 2 hrs to fix
            apps/jobs/views.py on lines 1615..1632

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

            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 pending_submissions == 0 or parse(
                    challenge["end_date"]
                ) < pytz.UTC.localize(datetime.utcnow()):
                    stop_instance(challenge, evalai_interface)
                else:
            Severity: Major
            Found in scripts/monitoring/auto_scale_ec2_workers.py and 1 other location - About 2 hrs to fix
            scripts/monitoring/auto_scale_workers.py on lines 80..87

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

            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