Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Function createTemplateChallenge has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createTemplateChallenge() {
    if (this.challengeData != null) {
      const FORM_DATA: FormData = new FormData();
      this.challengeData['is_challenge_template'] = true;
      this.challengeData['template_id'] = this.id;

    Function start_workers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def start_workers(queryset):
        """
        The function called by the admin action method to start all the selected workers.
    
        Calls the service_manager method. Before calling, checks if all the workers are incactive.
    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_or_create_sqs_queue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_or_create_sqs_queue(queue_name, challenge=None):
        if settings.DEBUG or settings.TEST:
            queue_name = "evalai_submission_queue"
            sqs = boto3.resource(
                "sqs",
    Severity: Minor
    Found in apps/base/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 save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def save(self, *args, **kwargs):
    
            if not self.pk:
                sub_num = Submission.objects.filter(
                    challenge_phase=self.challenge_phase,
    Severity: Minor
    Found in apps/jobs/models.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_workers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def stop_workers(queryset):
        """
        The function called by the admin action method to stop all the selected workers.
    
        Calls the service_manager method. Before calling, verifies that the challenge is not new, and is active.
    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 accept_challenge_invitation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def accept_challenge_invitation(request, invitation_key):
        try:
            invitation = UserInvitation.objects.get(invitation_key=invitation_key)
        except UserInvitation.DoesNotExist:
            response_data = {
    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 contact_us has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def contact_us(request):
        user_does_not_exist = False
        try:
            user = User.objects.get(username=request.user)
            name = user.username
    Severity: Minor
    Found in apps/web/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 formSubmit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      formSubmit(self) {
        self.submissionError = '';
        let metaValue = true;
        const submissionFile = self.globalService.formItemForLabel(self.components, 'input_file').fileValue;
        const submissionProjectUrl = self.globalService.formValueForLabel(self.components, 'project_url');

    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 11 (exceeds 5 allowed). Consider refactoring.
    Open

      ngOnInit() {
        this.routerPublic = this.router;
    
        if (!this.authService.isLoggedIn()) {
          this.router.navigate([this.authRoutePath]);

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

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

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

                      onSuccess: function(response) {
                          var data = response.data;
                          var results = data.results;
                          
                          var timezone = moment.tz.guess();
      Severity: Minor
      Found in frontend/src/js/controllers/challengeListCtrl.js - About 1 hr to fix

        Function ourTeamCtrl has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function ourTeamCtrl(utilities) {
                /* jshint validthis: true */
                var vm = this;
        
                var parameters = {};
        Severity: Minor
        Found in frontend/src/js/controllers/ourteamCtrl.js - About 1 hr to fix

          Function fetchRefreshJWTToken has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  vm.fetchRefreshJWTToken = function () {
                      if (userKey) {
                          var parameters = {};
                          parameters.url = 'accounts/user/get_auth_token';
                          parameters.method = 'GET';
          Severity: Minor
          Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

            Function fetchParticipantTeams has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private fetchParticipantTeams(id) {
                const API_PATH = this.endpointsService.challengeParticipantTeamsURL(id);
                const SELF = this;
                this.apiService.getUrl(API_PATH).subscribe(
                  (data) => {
            Severity: Minor
            Found in frontend_v2/src/app/services/challenge.service.ts - About 1 hr to fix

              Function poller has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              vm.poller = $interval(function() {
                                  parameters.url = "jobs/challenge/" + vm.challengeId + "/challenge_phase/" + vm.phaseId + "/submission/?page=" + Math.ceil(vm.currentPage);
                                  parameters.method = 'GET';
                                  parameters.data = {};
                                  parameters.callback = {
              Severity: Minor
              Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

                Function inviteOthers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        vm.inviteOthers = function(ev, participantTeamId) {
                            ev.stopPropagation();
                            // Appending dialog to document.body to cover sidenav in docs app
                            var confirm = $mdDialog.prompt()
                                .title('Add other members to this Team')
                Severity: Minor
                Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr to fix

                  Function passwordStrength has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          this.passwordStrength = function(password){
                  
                             //Regular Expressions.  
                              var regex = new Array();
                              regex.push("[A-Z]","[a-z]","[0-9]","[$$!%*#?&]");
                  Severity: Minor
                  Found in frontend/src/js/services/services.js - About 1 hr to fix

                    Function load has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                        vm.load = function(url) {
                                            // loader for existing teams
                                            vm.isExistLoader = true;
                                            vm.loaderTitle = '';
                                            vm.loaderContainer = angular.element('.exist-team-card');
                    Severity: Minor
                    Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

                      Function passwordStrength has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        passwordStrength(password) {
                          // Regular Expressions.
                          const REGEX = new Array();
                          REGEX.push('[A-Z]', '[a-z]', '[0-9]', '[$$!%*#?&]');
                      
                      
                      Severity: Minor
                      Found in frontend_v2/src/app/services/auth.service.ts - About 1 hr to fix

                        Function validateInput has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          validateInput(e) {
                            this.isDirty = true;
                            this.value = e;
                            e === '' ? (this.isEmpty = true) : (this.isEmpty = false);
                            if (e === '' && this.isRequired) {
                        Severity: Minor
                        Found in frontend_v2/src/app/components/utility/input/input.component.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language