Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Avoid deeply nested control flow statements.
Open

                        if serializer.is_valid():
                            serializer.save()
                        else:
                            error_messages = f"challenge phase {data['id']} :{str(serializer.errors)}"
                            raise RuntimeError()
Severity: Major
Found in apps/challenges/views.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            for email in emails:
                                user = User.objects.get(email=email)
                                host = Participant(
                                    user=user,
                                    status=Participant.ACCEPTED,
    Severity: Major
    Found in apps/challenges/views.py - About 45 mins to fix

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

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

        Function update_challenge_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def update_challenge_attributes(request):
            """
            API to update attributes of the Challenge model
            Arguments:
                request {dict} -- Request object
        Severity: Minor
        Found in apps/challenges/views.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                if dataset_split_ids.get(str(data["dataset_split_id"])) is None:
                                    message = (
                                        "Dataset split with id {} doesn't exist.".format(data["dataset_split_id"])
                                    )
                                    response_data = {"error": message}
        Severity: Major
        Found in apps/challenges/views.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  with open(
                                      test_annotation_file_path, "rb"
                                  ) as test_annotation_file:
                                      challenge_test_annotation_file = ContentFile(
                                          test_annotation_file.read(),
          Severity: Major
          Found in apps/challenges/views.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if challenge_phase_ids.get(str(data["challenge_phase_id"])) is None:
                                        message = (
                                            "Challenge phase with phase id {} doesn't exist.".format(data["challenge_phase_id"])
                                        )
                                        response_data = {"error": message}
            Severity: Major
            Found in apps/challenges/views.py - About 45 mins to fix

              Function get_remaining_submission_for_a_phase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_remaining_submission_for_a_phase(
                  user, challenge_phase_pk, challenge_pk
              ):
                  """
                  Returns the number of remaining submissions that a participant can
              Severity: Minor
              Found in apps/jobs/utils.py - About 45 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 toggleLeaderboardVisibility has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                toggleLeaderboardVisibility() {
                  const SELF = this;
                  let toggleLeaderboardVisibilityState, visibility, phaseIsPublic;
                  for (let i = 0; i < SELF.filteredPhases.length; i++) {
                    if (SELF.filteredPhases[i]['name'] === SELF.selectedPhaseSplit['challenge_phase_name']) {

              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

              Avoid deeply nested control flow statements.
              Open

                    if (e.target.value === this.oldPassword) {
                      this.inputErrorMessage = 'Old password cannot be same as New Password';
                    }
              Severity: Major
              Found in frontend_v2/src/app/components/utility/modal/modal.component.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                    } else if (e.target.name === 'new_password2') {
                      this.retype_newPassword = e.target.value;
                      if (e.target.value !== this.newPassword) {
                        this.inputErrorMessage = 'Password do not match';
                      }
                Severity: Major
                Found in frontend_v2/src/app/components/utility/modal/modal.component.ts - About 45 mins to fix

                  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

                    Avoid deeply nested control flow statements.
                    Open

                            if (!this.invalidFields.find((element) => element === 'LinkedIn')) {
                              this.invalidFields.push('LinkedIn');
                            }
                    Severity: Major
                    Found in frontend_v2/src/app/components/utility/modal/modal.component.ts - 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

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

                                filterPhases() {
                                  if (this.phases.length > 0 && this.phaseSplits.length > 0) {
                                    for (let i = 0; i < this.phaseSplits.length; i++) {
                                      if (this.phaseSplits[i].visibility !== this.challengePhaseVisibility.public) {
                                        this.phaseSplits[i].showPrivate = true;

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

                                toggleFilter(filter) {
                                  this[filter] = !this[filter];
                                  if (this[filter]) {
                                    this.fetchChallenges(filter);
                                  } else {

                              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

                              Avoid deeply nested control flow statements.
                              Open

                                          if (value === null || value === undefined || value.length === 0) {
                                            metaValue = false;
                                          }
                                Severity
                                Category
                                Status
                                Source
                                Language