Cloud-CV/EvalAI

View on GitHub

Showing 1,371 of 1,371 total issues

Function handleFormError has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  handleFormError(form, err, toast = true) {
    const ERR = err.error;
    if (this.toastErrorCodes.indexOf(err.status) > -1 && ERR !== null && typeof ERR === 'object') {
      console.error(err);
      for (const KEY in ERR) {
Severity: Minor
Found in frontend_v2/src/app/services/global.service.ts - 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

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

        if (
            submissions_in_progress
            >= challenge_phase.max_concurrent_submissions_allowed
        ):
            message = "You have {} submissions that are being processed. \
Severity: Major
Found in apps/jobs/views.py and 1 other location - About 1 hr to fix
apps/jobs/views.py on lines 2625..2632

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

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 'rank' not in prize or 'amount' not in prize:
                    message = self.error_messages_dict["prize_not_found"]
                    self.error_messages.append(message)
Severity: Major
Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 hr to fix
apps/challenges/challenge_config_utils.py on lines 1011..1014

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

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

            for sponsor in self.yaml_file_data["sponsors"]:
                if 'name' not in sponsor or 'website' not in sponsor:
                    message = self.error_messages_dict["sponsor_not_found"]
                    self.error_messages.append(message)
Severity: Major
Found in apps/challenges/challenge_config_utils.py and 1 other location - About 1 hr to fix
apps/challenges/challenge_config_utils.py on lines 1021..1023

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

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 (
        submissions_in_progress
        >= challenge_phase.max_concurrent_submissions_allowed
    ):
        message = "You have {} submissions that are being processed. \
Severity: Major
Found in apps/jobs/views.py and 1 other location - About 1 hr to fix
apps/jobs/views.py on lines 278..286

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

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

        vm.check_approval_status = function(challengeId, participant_team_id, approved_status, formvalid){
            var parameters = {};
            parameters.token = utilities.getData('userKey');
            parameters.method = 'POST';
            if(approved_status) {
Severity: Minor
Found in frontend/src/js/controllers/challengeCtrl.js - About 1 hr to fix

    Function getAllResults has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            vm.getAllResults = function(parameters, resultsArray, typ){
                parameters.callback = {
                    onSuccess: function(response) {
                        var data = response.data;
                        var results = data.results;
    Severity: Minor
    Found in frontend/src/js/controllers/challengeListCtrl.js - About 1 hr to fix

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

                      onSuccess: function(response) {
                          $rootScope.notify("success", "New team- '" + vm.team.name + "' has been created");
                          var details = response.data;
                          vm.teamId = details.id;
                          vm.team.error = false;
      Severity: Minor
      Found in frontend/src/js/controllers/challengeHostTeamsCtrl.js - About 1 hr to fix

        Function sendRequest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                this.sendRequest = function(parameters, header, type) {
                    var url = EnvironmentConfig.API + parameters.url;
                    var data = parameters.data;
                    var token = parameters.token;
                    var method = parameters.method;
        Severity: Minor
        Found in frontend/src/js/services/services.js - About 1 hr to fix

          Function editChallengeOverviewUpload has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            editChallengeOverviewUpload() {
              const SELF = this;
              SELF.apiCall = (params) => {
                const FORM_DATA: FormData = new FormData();
                FORM_DATA.append('overview_file', params['overview_file']);

            Function editEvaluationCriteriaUpload has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              editEvaluationCriteriaUpload() {
                const SELF = this;
                SELF.apiCall = (params) => {
                  const FORM_DATA: FormData = new FormData();
                  FORM_DATA.append('evaluation_criteria_file', params['evaluation_criteria_file']);

              Function editLeaderboardSchema has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                editLeaderboardSchema() {
                  const SELF = this;
                  SELF.apiCall = (params) => {
                    let currentLeaderboard = this.leaderboard;
                    this.logger.info(params);

                Function editChallengeTermsAndConditionsUpload has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  editChallengeTermsAndConditionsUpload() {
                    const SELF = this;
                    SELF.apiCall = (params) => {
                      const FORM_DATA: FormData = new FormData();
                      FORM_DATA.append('terms_and_conditions_file', params['terms_and_conditions_file']);

                  Function editChallengeImage has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    editChallengeImage() {
                      const SELF = this;
                      SELF.apiCall = (params) => {
                        const FORM_DATA: FormData = new FormData();
                        FORM_DATA.append('image', params['image']);

                    Function editTestAnnotations has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      editTestAnnotations() {
                        const SELF = this;
                        SELF.apiCall = (params) => {
                          const FORM_DATA: FormData = new FormData();
                          FORM_DATA.append('test_annotation', params['test_annotation']);

                      Function editSubmissionGuidelineUpload has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                         editSubmissionGuidelineUpload() {
                          const SELF = this;
                          SELF.apiCall = (params) => {
                            const FORM_DATA: FormData = new FormData();
                            FORM_DATA.append('submission_guidelines_file', params['submission_guidelines_file']);

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

                          ngOnInit() {
                            if (this.authService.isLoggedIn()) {
                              this.isLoggedIn = true;
                            }
                            this.routerPublic = this.router;

                          Function addMembersToTeamWrapper has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            addMembersToTeamWrapper() {
                              const SELF = this;
                              const addMembersToTeam = (team) => {
                                SELF.apiCall = (params) => {
                                  const BODY = JSON.stringify(params);

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

                                                if (data.next !== null) {
                                                    var url = data.next;
                                                    var slicedUrl = url.substring(url.indexOf('challenges/challenge'), url.length);
                                                    parameters.url = slicedUrl;
                                                    vm.getAllResults(parameters, resultsArray);
                            Severity: Major
                            Found in frontend/src/js/controllers/challengeListCtrl.js and 1 other location - About 1 hr to fix
                            frontend/src/js/controllers/dashCtrl.js on lines 68..73

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

                            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 (details.next !== null){
                                                        var url = details.next;
                                                        var slicedUrl = url.substring(url.indexOf('challenges/challenge'), url.length);
                                                        parameters.url = slicedUrl;
                                                        vm.getAllChallenges(parameters, counter);
                            Severity: Major
                            Found in frontend/src/js/controllers/dashCtrl.js and 1 other location - About 1 hr to fix
                            frontend/src/js/controllers/challengeListCtrl.js on lines 58..70

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

                            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