Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Avoid too many return statements within this function.
Open

                return Response(
Severity: Major
Found in apps/challenges/views.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return Math.floor(DIFF_DAYS) + ' day(s)';
    Severity: Major
    Found in frontend_v2/src/app/services/global.service.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return;

        Avoid too many return statements within this function.
        Open

              return;

          Avoid too many return statements within this function.
          Open

                    return Math.floor(DIFF_WEEKS) + ' week(s)';
          Severity: Major
          Found in frontend_v2/src/app/services/global.service.ts - About 30 mins to fix

            Function get_view_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_view_name(self, request):
                    view_name = "<unnamed view>"
                    if hasattr(request, "resolver_match"):
                        if request.resolver_match is not None:
                            if request.resolver_match.view_name is not None:
            Severity: Minor
            Found in middleware/statsd/statsd_middleware.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_signed_url_for_submission_related_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_signed_url_for_submission_related_file(request):
                """Returns S3 signed URL for a particular file residing on S3 bucket
            
                Arguments:
                    request {object} -- Request object
            Severity: Minor
            Found in apps/jobs/views.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 remove_self_from_participant_team has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def remove_self_from_participant_team(request, participant_team_pk):
                """
                A user can remove himself from the participant team.
                """
                try:
            Severity: Minor
            Found in apps/participants/views.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 start_or_stop_workers_for_challenges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def start_or_stop_workers_for_challenges(response, evalai_interface):
                for challenge in response["results"]:
                    if challenge["uses_ec2_worker"]:
                        try:
                            start_or_stop_workers(challenge, evalai_interface)
            Severity: Minor
            Found in scripts/monitoring/auto_scale_ec2_workers.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 check_database has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def check_database():
                if len(EmailAddress.objects.all()) > 0:
                    print(
                        "Are you sure you want to wipe the existing development database and reseed it? (Y/N)"
                    )
            Severity: Minor
            Found in scripts/seed.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_or_update_leaderboard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_or_update_leaderboard(request, leaderboard_pk):
                """
                Returns or Updates a leaderboard
                """
                leaderboard = get_leaderboard_model(leaderboard_pk)
            Severity: Minor
            Found in apps/challenges/views.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 suppress_autotime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def suppress_autotime(model, fields):
                _original_values = {}
                for field in model._meta.local_fields:
                    if field.name in fields:
                        _original_values[field.name] = {
            Severity: Minor
            Found in apps/base/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 participant_team_detail_for_challenge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def participant_team_detail_for_challenge(request, challenge_pk):
                """
                Returns the participated team detail in the challenge
                Arguments:
                    challenge_pk {int} -- Challenge primary key
            Severity: Minor
            Found in apps/challenges/views.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 onWindowScroll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              @HostListener('window:scroll', [])
              onWindowScroll(): void {
                if (this.document.documentElement.scrollTop > 50) {
                  if (this.scrolledState === false) {
                    this.globalService.scrolledStateChange(true);
            Severity: Minor
            Found in frontend_v2/src/app/app.component.ts - 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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              add(event: MatChipInputEvent): void {
                const SELF = this;
                const input = event.input;
                const value = event.value;
                SELF.isValidationError = false;

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

                def __init__(self, *args, **kwargs):
                    super(ZipChallengePhaseSplitSerializer, self).__init__(*args, **kwargs)
            
                    context = kwargs.get("context")
                    if context:
            Severity: Minor
            Found in apps/challenges/serializers.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 subscribe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def subscribe(request):
                if request.method == "GET":
                    subscribers = Subscribers.objects.all().order_by("-pk")
                    serializer = SubscribeSerializer(
                        subscribers, many=True, context={"request": request}
            Severity: Minor
            Found in apps/web/views.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 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 create_eks_cluster_or_ec2_for_challenge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def create_eks_cluster_or_ec2_for_challenge(sender, instance, created, **kwargs):
                field_name = "approved_by_admin"
                import challenges.aws_utils as aws
            
                if not created and is_model_field_changed(instance, field_name):
            Severity: Minor
            Found in apps/challenges/models.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 ngOnInit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              ngOnInit() {
                if (this.params['title']) {
                  this.title = this.params['title'];
                }
                if (this.params['content']) {
            Severity: Minor
            Found in frontend_v2/src/app/components/utility/confirm/confirm.component.ts - 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

            Severity
            Category
            Status
            Source
            Language