Cloud-CV/EvalAI

View on GitHub

Showing 666 of 1,371 total issues

Function ngOnInit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  ngOnInit() {
    if (this.params) {
      if (this.params['title']) {
        this.title = this.params['title'];
      }

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

    function HostedChallengesCtrl(utilities) {
        var vm = this;
        var userKey = utilities.getData('userKey');

        utilities.showLoader();
Severity: Minor
Found in frontend/src/js/controllers/hostedChallengeCtrl.js - About 1 hr to fix

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

      ngOnInit() {
        this.globalService.startLoader('');
        const SELF = this;
        if (this.authService.isLoggedIn()) {
          this.isLoggedIn = true;
    Severity: Minor
    Found in frontend_v2/src/app/components/challenge/challenge.component.ts - About 1 hr to fix

      Function resetPasswordConfirm has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        resetPasswordConfirm(resetconfirmFormValid) {
          if (resetconfirmFormValid) {
            this.globalService.startLoader('Resetting Your Password');
      
            const RESET_BODY = JSON.stringify({

        Function updateChallengeHostTeamData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                vm.updateChallengeHostTeamData = function(updateChallengeHostTeamDataForm) {
                    if (updateChallengeHostTeamDataForm) {
                    var parameters = {};
                    parameters.url = 'hosts/challenge_host_team/' + vm.hostTeamId;
                    parameters.method = 'PATCH';
        Severity: Minor
        Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 1 hr to fix

          Function updateParticipantTeamData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  vm.updateParticipantTeamData = function(updateParticipantTeamDataForm) {
                      if (updateParticipantTeamDataForm) {
                      var parameters = {};
                      parameters.url = 'participants/participant_team/' + vm.participantTeamId;
                      parameters.method = 'PATCH';
          Severity: Minor
          Found in frontend/src/js/controllers/teamsCtrl.js - About 1 hr to fix

            Function fetchChallenge has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              fetchChallenge(id) {
                const API_PATH = this.endpointsService.challengeDetailsURL(id);
                const SELF = this;
                this.changeCurrentPhases([]);
                this.changeCurrentPhaseSplit([]);
            Severity: Minor
            Found in frontend_v2/src/app/services/challenge.service.ts - About 1 hr to fix

              Function contactUs has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      vm.contactUs = function(resetconfirmFormValid) {
                          if (resetconfirmFormValid) {
              
                              var parameters = {};
                              vm.isDisabled = false;
              Severity: Minor
              Found in frontend/src/js/controllers/contactUsCtrl.js - About 1 hr to fix

                Function togglePublishChallengeState has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  togglePublishChallengeState() {
                    const SELF = this;
                    let toggleChallengePublishState, isPublished;
                    if (this.publishChallenge.state === 'Published') {
                      toggleChallengePublishState = 'private';

                  Function editPhaseDetails has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    editPhaseDetails() {
                      const SELF = this;
                      SELF.apiCall = (params) => {
                        const FORM_DATA: FormData = new FormData();
                        for (const key in params) {

                    Function editTeam has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        const editTeam = (team) => {
                          const teamId = team['id'];
                          const teamName = team['team_name'];
                          const teamUrl = team['team_url'];
                          TeamUrl = this.isHost

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

                                          onSuccess: function(response) {
                                              if (response.status == 201) {
                                                  vm.isFormError = false;
                                                  // Redirecting to Dashboard on Signup with limited privilege
                                                  $rootScope.notify("success", "Registered successfully. Please verify your email address!");
                      Severity: Minor
                      Found in frontend/src/js/controllers/authCtrl.js - About 1 hr to fix

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

                                vm.userLogin = function(loginFormValid) {
                                    if (loginFormValid) {
                                        vm.startLoader("Taking you to EvalAI!");
                                        // call utility service
                                        var parameters = {};
                        Severity: Minor
                        Found in frontend/src/js/controllers/authCtrl.js - About 1 hr to fix

                          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

                            Severity
                            Category
                            Status
                            Source
                            Language