Cloud-CV/EvalAI

View on GitHub
apps/challenges/challenge_config_utils.py

Summary

Maintainability
F
2 wks
Test Coverage

File challenge_config_utils.py has 1029 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import requests
import zipfile
import yaml

Severity: Major
Found in apps/challenges/challenge_config_utils.py - About 2 days to fix

    Function validate_challenge_phases has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_challenge_phases(self, current_phase_config_ids):
            challenge_phases_data = self.yaml_file_data.get("challenge_phases")
            if not challenge_phases_data:
                message = self.error_messages_dict["missing_challenge_phases"]
                self.error_messages.append(message)
    Severity: Minor
    Found in apps/challenges/challenge_config_utils.py - About 1 day 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 validate_leaderboards has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_leaderboards(self, current_leaderboard_config_ids):
            leaderboard = self.yaml_file_data.get("leaderboard")
            if leaderboard:
                for data in leaderboard:
                    error = False
    Severity: Minor
    Found in apps/challenges/challenge_config_utils.py - About 6 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 validate_challenge_phase_splits has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_challenge_phase_splits(self, current_phase_split_ids):
            challenge_phase_splits = self.yaml_file_data.get(
                "challenge_phase_splits"
            )
            # Check for duplicate combinations
    Severity: Minor
    Found in apps/challenges/challenge_config_utils.py - About 4 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 validate_dataset_splits has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_dataset_splits(self, current_dataset_config_ids):
            dataset_splits = self.yaml_file_data.get("dataset_splits")
            dataset_split_codenames = []
            self.dataset_splits_ids = []
            if dataset_splits:
    Severity: Minor
    Found in apps/challenges/challenge_config_utils.py - About 4 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 check_prizes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_prizes(self):
            # Verify Prizes are correct
            if "prizes" in self.yaml_file_data:
                rank_set = set()
                for prize in self.yaml_file_data["prizes"]:
    Severity: Minor
    Found in apps/challenges/challenge_config_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 validate_evaluation_script_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_evaluation_script_file(self):
            evaluation_script = self.yaml_file_data.get("evaluation_script")
            if evaluation_script:
                if not evaluation_script.endswith('.zip'):
                    message = self.error_messages_dict.get(
    Severity: Minor
    Found in apps/challenges/challenge_config_utils.py - About 55 mins 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 validate_challenge_config_util has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def validate_challenge_config_util(
    Severity: Minor
    Found in apps/challenges/challenge_config_utils.py - About 45 mins to fix

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in apps/challenges/challenge_config_utils.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if attribute_type in valid_attribute_types:
                                    if (
                                        attribute_type == "radio"
                                        or attribute_type == "checkbox"
                                    ):
        Severity: Major
        Found in apps/challenges/challenge_config_utils.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (
                                      "labels" in data["schema"]
                                      and default_order_by
                                      not in data["schema"]["labels"]
                                  ):
          Severity: Major
          Found in apps/challenges/challenge_config_utils.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (
                                        current_leaderboard_config_ids
                                        and int(data["id"])
                                        not in current_leaderboard_config_ids
                                    ):
            Severity: Major
            Found in apps/challenges/challenge_config_utils.py - About 45 mins to fix

              Function is_challenge_phase_split_mapping_valid has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def is_challenge_phase_split_mapping_valid(
              Severity: Minor
              Found in apps/challenges/challenge_config_utils.py - About 35 mins to fix

                Function check_sponsor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def check_sponsor(self):
                        # Verify Sponsor is correct
                        if "sponsors" in self.yaml_file_data:
                            for sponsor in self.yaml_file_data["sponsors"]:
                                if 'name' not in sponsor or 'website' not in sponsor:
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py - About 35 mins 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 validate_challenge_logo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validate_challenge_logo(self):
                        image = self.yaml_file_data.get("image")
                        if image and (
                            image.endswith(".jpg")
                            or image.endswith(".jpeg")
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py - About 35 mins 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 is_challenge_config_yaml_html_field_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def is_challenge_config_yaml_html_field_valid(
                    yaml_file_data, key, base_location
                ):
                    """
                    Arguments:
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py - About 25 mins 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 validate_dates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validate_dates(self):
                        start_date = self.yaml_file_data.get("start_date")
                        end_date = self.yaml_file_data.get("end_date")
                
                        if not start_date or not end_date:
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py - About 25 mins 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_yaml_files_from_challenge_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_yaml_files_from_challenge_config(zip_ref):
                    """
                    Arguments:
                        zip_ref {zipfile} -- reference to challenge config zip
                    Returns:
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py - About 25 mins 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

                            if not serializer.is_valid():
                                serializer_error = str(serializer.errors)
                                message = self.error_messages_dict[
                                    "challenge_phase_schema_errors"
                                ].format(data["id"], serializer_error)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 day to fix
                apps/challenges/challenge_config_utils.py on lines 963..978

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

                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 not serializer.is_valid():
                                    serializer_error = str(serializer.errors)
                                    message = self.error_messages_dict[
                                        "dataset_split_schema_errors"
                                    ].format(split["id"], serializer_error)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 day to fix
                apps/challenges/challenge_config_utils.py on lines 792..807

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

                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

                    def validate_terms_and_conditions_file(self):
                        terms_and_conditions = self.yaml_file_data.get("terms_and_conditions")
                        if not terms_and_conditions or len(terms_and_conditions) == 0:
                            message = self.error_messages_dict.get(
                                "missing_terms_and_conditions"
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
                apps/challenges/challenge_config_utils.py on lines 406..425
                apps/challenges/challenge_config_utils.py on lines 429..450
                apps/challenges/challenge_config_utils.py on lines 479..502

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

                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

                    def validate_challenge_description(self):
                        challenge_description = self.yaml_file_data.get("description")
                        if not challenge_description or len(challenge_description) == 0:
                            message = self.error_messages_dict.get(
                                "missing_challenge_description"
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
                apps/challenges/challenge_config_utils.py on lines 429..450
                apps/challenges/challenge_config_utils.py on lines 454..475
                apps/challenges/challenge_config_utils.py on lines 479..502

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

                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

                    def validate_submission_guidelines_file(self):
                        submission_guidelines = self.yaml_file_data.get(
                            "submission_guidelines"
                        )
                        if not submission_guidelines or len(submission_guidelines) == 0:
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
                apps/challenges/challenge_config_utils.py on lines 406..425
                apps/challenges/challenge_config_utils.py on lines 429..450
                apps/challenges/challenge_config_utils.py on lines 454..475

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

                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

                    def validate_evaluation_details_file(self):
                        evaluation_details = self.yaml_file_data.get("evaluation_details")
                        if not evaluation_details or len(evaluation_details) == 0:
                            message = self.error_messages_dict.get(
                                "missing_evaluation_details"
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 3 other locations - About 1 day to fix
                apps/challenges/challenge_config_utils.py on lines 406..425
                apps/challenges/challenge_config_utils.py on lines 454..475
                apps/challenges/challenge_config_utils.py on lines 479..502

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

                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 "codename" not in split:
                                    message = self.error_messages_dict[
                                        "missing_dataset_split_codename"
                                    ].format(split.get("id"))
                                    self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 4 hrs to fix
                apps/challenges/challenge_config_utils.py on lines 659..670

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 75.

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

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

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

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

                Refactorings

                Further Reading

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

                            if "codename" not in data:
                                self.error_messages.append(
                                    self.error_messages_dict["no_codename_for_challenge_phase"]
                                )
                            else:
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 4 hrs to fix
                apps/challenges/challenge_config_utils.py on lines 946..958

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 75.

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

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

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

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

                Refactorings

                Further Reading

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

                                if uuid not in challenge_phase_split_uuids:
                                    message = self.error_messages_dict[
                                        "challenge_phase_split_not_found"
                                    ].format(uuid[0], uuid[1], uuid[2])
                                    self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 2 hrs to fix
                apps/challenges/challenge_config_utils.py on lines 842..846

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

                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

                            for combination in total_duplicates:
                                message = self.error_messages_dict[
                                    "duplicate_combinations_in_challenge_phase_splits"
                                ].format(combination[0], combination[1], combination[2])
                                self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 2 hrs to fix
                apps/challenges/challenge_config_utils.py on lines 922..926

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

                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

                        for current_challenge_phase_id in current_phase_config_ids:
                            if current_challenge_phase_id not in self.phase_ids:
                                message = self.error_messages_dict[
                                    "challenge_phase_not_found"
                                ].format(current_challenge_phase_id)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 983..988

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

                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

                        for current_dataset_split_config_id in current_dataset_config_ids:
                            if current_dataset_split_config_id not in self.dataset_splits_ids:
                                message = self.error_messages_dict[
                                    "missing_existing_dataset_split_id"
                                ].format(current_dataset_split_config_id)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 809..814

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

                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 'rank' not in prize or 'amount' not in prize:
                                    message = self.error_messages_dict["prize_not_found"]
                                    self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 1011..1014

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

                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

                            for sponsor in self.yaml_file_data["sponsors"]:
                                if 'name' not in sponsor or 'website' not in sponsor:
                                    message = self.error_messages_dict["sponsor_not_found"]
                                    self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 1021..1023

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

                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

                                    if "default_order_by" not in data["schema"]:
                                        message = self.error_messages_dict.get(
                                            "missing_leaderboard_default_order_by"
                                        ).format(data.get("id"))
                                        self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 2 other locations - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 584..589
                apps/challenges/challenge_config_utils.py on lines 591..596

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

                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

                                if "schema" not in data:
                                    message = self.error_messages_dict.get(
                                        "missing_leaderboard_schema"
                                    ).format(data.get("id"))
                                    self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 2 other locations - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 591..596
                apps/challenges/challenge_config_utils.py on lines 597..602

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

                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

                                    if "labels" not in data["schema"]:
                                        message = self.error_messages_dict.get(
                                            "missing_leaderboard_labels"
                                        ).format(data.get("id"))
                                        self.error_messages.append(message)
                Severity: Major
                Found in apps/challenges/challenge_config_utils.py and 2 other locations - About 1 hr to fix
                apps/challenges/challenge_config_utils.py on lines 584..589
                apps/challenges/challenge_config_utils.py on lines 597..602

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

                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 not name:
                                    message = self.error_messages_dict[
                                        "missing_dataset_split_name"
                                    ].format(split.get("id"))
                                    self.error_messages.append(message)
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 55 mins to fix
                apps/challenges/challenge_config_utils.py on lines 946..950

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

                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 not start_date or not end_date:
                                message = self.error_messages_dict.get(
                                    "missing_dates_challenge_phase"
                                ).format(data.get("id"))
                                self.error_messages.append(message)
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 55 mins to fix
                apps/challenges/challenge_config_utils.py on lines 730..734

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

                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 start_date > end_date:
                                    message = self.error_messages_dict.get(
                                        "start_date_greater_than_end_date_challenge_phase"
                                    ).format(data.get("id"))
                                    self.error_messages.append(message)
                Severity: Minor
                Found in apps/challenges/challenge_config_utils.py and 1 other location - About 55 mins to fix
                apps/challenges/challenge_config_utils.py on lines 724..728

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

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

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

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

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

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status