Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

Function ngOnInit has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  ngOnInit() {
    if (!this.type || this.type === 'email') {
      if (this.type === 'email') {
        this.isEmail = true;
      }
Severity: Minor
Found in frontend_v2/src/app/components/utility/input/input.component.ts - About 1 hr to fix

    Function participant_team_detail has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def participant_team_detail(request, pk):
    
        try:
            participant_team = ParticipantTeam.objects.get(pk=pk)
        except ParticipantTeam.DoesNotExist:
    Severity: Minor
    Found in apps/participants/views.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 main has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        killer = GracefulKiller()
        logger.info(
            "Using {0} as temp directory to store data".format(BASE_TEMP_DIR)
        )
    Severity: Minor
    Found in scripts/workers/remote_submission_worker.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 create_ec2_instance_by_challenge_pk has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_ec2_instance_by_challenge_pk(request, challenge_pk):
        """
        API to create EC2 instance for a challenge
        Arguments:
            request {HttpRequest} -- The request object
    Severity: Minor
    Found in apps/challenges/views.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 stop_ec2_instance has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def stop_ec2_instance(challenge):
        """
        Stop the EC2 instance associated with a challenge if status checks are ready.
    
        Args:
    Severity: Minor
    Found in apps/challenges/aws_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 get_logs_from_cloudwatch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_logs_from_cloudwatch(
        log_group_name, log_stream_prefix, start_time, end_time, pattern, limit
    ):
        """
        To fetch logs of a container from cloudwatch within a specific time frame.
    Severity: Minor
    Found in apps/challenges/aws_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 manage_worker has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def manage_worker(request, challenge_pk, action):
        if not request.user.is_staff:
            if not is_user_a_host_of_challenge(request.user, challenge_pk):
                response_data = {
                    "error": "Sorry, you are not authorized for access worker operations."
    Severity: Minor
    Found in apps/challenges/views.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

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

        try:
            user = User.objects.get(email=request.user.email)
        except User.DoesNotExist:
            response_data = {"error": "This User account doesn't exist."}
            Response(response_data, status.HTTP_404_NOT_FOUND)
    Severity: Major
    Found in apps/accounts/views.py and 1 other location - About 1 hr to fix
    apps/accounts/views.py on lines 46..50

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

    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

        try:
            user = User.objects.get(email=request.user.email)
        except User.DoesNotExist:
            response_data = {"error": "This User account doesn't exist."}
            Response(response_data, status.HTTP_404_NOT_FOUND)
    Severity: Major
    Found in apps/accounts/views.py and 1 other location - About 1 hr to fix
    apps/accounts/views.py on lines 95..99

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

    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

      patchFileUrl(path: string, formData: any) {
        this.prepareHttpOptions(true);
        return this.loadingWrapper(this.http.patch(this.API + path, formData, this.HTTP_OPTIONS));
      }
    Severity: Major
    Found in frontend_v2/src/app/services/api.service.ts and 1 other location - About 1 hr to fix
    frontend_v2/src/app/services/api.service.ts on lines 91..94

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

    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 num_workers == 0:
            response = start_worker(challenge["id"])
            print("AWS API Response: {}".format(response))
            print(
                "Started worker for Challenge ID: {}, Title: {}.".format(
    Severity: Major
    Found in scripts/monitoring/auto_scale_workers.py and 1 other location - About 1 hr to fix
    scripts/monitoring/auto_scale_workers.py on lines 28..33

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

    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:
            messages = queue.receive_messages()
            if len(messages):
                message_receipt_handle = messages[0].receipt_handle
                message_body = json.loads(messages[0].body)
    Severity: Major
    Found in apps/jobs/views.py and 1 other location - About 1 hr to fix
    apps/jobs/views.py on lines 2215..2229

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

    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:
            message = queue.Message(receipt_handle)
            message.delete()
            response_data = {
                "success": "Message deleted successfully from the queue: {}".format(
    Severity: Major
    Found in apps/jobs/views.py and 1 other location - About 1 hr to fix
    apps/jobs/views.py on lines 2120..2143

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

    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 num_workers > 0:
            response = stop_worker(challenge["id"])
            print("AWS API Response: {}".format(response))
            print(
                "Stopped worker for Challenge ID: {}, Title: {}".format(
    Severity: Major
    Found in scripts/monitoring/auto_scale_workers.py and 1 other location - About 1 hr to fix
    scripts/monitoring/auto_scale_workers.py on lines 45..50

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

    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

      postFileUrl(path: string, formData: any) {
        this.prepareHttpOptions(true);
        return this.loadingWrapper(this.http.post(this.API + path, formData, this.HTTP_OPTIONS));
      }
    Severity: Major
    Found in frontend_v2/src/app/services/api.service.ts and 1 other location - About 1 hr to fix
    frontend_v2/src/app/services/api.service.ts on lines 101..104

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

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

            vm.changeSubmissionVisibility = function(submission_id, submissionVisibility) {
                parameters.url = "jobs/challenge/" + vm.challengeId + "/challenge_phase/" + vm.phaseId + "/submission/" + submission_id;
                parameters.method = 'PATCH';
                parameters.data = {
                    "is_public": submissionVisibility
    Severity: Minor
    Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

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

                      onSuccess: function(response) {
                          var status = response.status;
                          for (var phase in response.data.phases) {
                              if (response.data.phases[phase].id == phaseID) {
                                 var details = response.data.phases[phase].limits;
      Severity: Minor
      Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

        Function changePassword has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                vm.changePassword = function(resetconfirmFormValid) {
                  if(resetconfirmFormValid){
        
        
                    vm.startLoader("Changing Your Password");
        Severity: Minor
        Found in frontend/src/js/controllers/changePwdCtrl.js - About 1 hr to fix

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

                (err) => {
                  if (err.status === 403) {
                    this.router.navigate(['permission-denied']);
                  }
                  this.globalService.stopLoader();
          frontend_v2/src/app/components/challenge/challengeparticipate/challengeparticipate.component.ts on lines 199..205

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

          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

            patchUrl(path: string, body: any) {
              this.prepareHttpOptions();
              return this.loadingWrapper(this.http.patch(this.API + path, body, this.HTTP_OPTIONS));
            }
          Severity: Major
          Found in frontend_v2/src/app/services/api.service.ts and 2 other locations - About 1 hr to fix
          frontend_v2/src/app/services/api.service.ts on lines 61..64
          frontend_v2/src/app/services/api.service.ts on lines 81..84

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

          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