crowdAI/crowdai

View on GitHub

Showing 178 of 178 total issues

Method change has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def change
    execute "update submissions set score = 0, score_secondary = 0 where challenge_id = 12;"
  execute "update submissions set score = 30.1795168296, score_secondary = 32.6215108021 where id = 3530;"
execute "update submissions set score = 29.7315225146, score_secondary = 32.2190151623 where id = 3532;"
execute "update submissions set score = 28.9940347595, score_secondary = 31.520271205 where id = 3535;"
Severity: Major
Found in doc/technical/archived_migrations/20180112152241_regrade_take3.rb - About 3 hrs to fix

    Method change has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def change
        create_view :challenge_views, "
        SELECT
        c.id,
        c.organizer_id,
    Severity: Major
    Found in doc/technical/archived_migrations/20160601050459_challenge_view.rb - About 3 hrs to fix

      Function makeSortable has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        makeSortable: function(table) {
          if (table.getElementsByTagName('thead').length == 0) {
            // table doesn't have a tHead. Since it should have, create one and
            // put the first table row in it.
            the = document.createElement('thead');
      Severity: Major
      Found in app/assets/javascripts/modules/sorttable.js - About 3 hrs to fix

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

                for(var i = b; i < t; ++i) {
                    if ( comp_func(list[i], list[i+1]) > 0 ) {
                        var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
                        swap = true;
                    }
        Severity: Major
        Found in app/assets/javascripts/modules/sorttable.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/modules/sorttable.js on lines 324..329

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

        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(var i = t; i > b; --i) {
                    if ( comp_func(list[i], list[i-1]) < 0 ) {
                        var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
                        swap = true;
                    }
        Severity: Major
        Found in app/assets/javascripts/modules/sorttable.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/modules/sorttable.js on lines 314..319

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

        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

        Method change has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def change
            drop_view :leaderboards
            create_view :leaderboards,
            "
            SELECT l.row_num,

          Method change has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def change
              execute "update submissions set score = 0, score_secondary = 0 where challenge_id = 12;"
              execute "update submissions set score = 28.5914468, score_secondary = 31.01892051 where id = 3530;"
          execute "update submissions set score = 28.17302633, score_secondary = 30.62651468 where id = 3532;"
          execute "update submissions set score = 27.08935975, score_secondary = 29.55906082 where id = 3535;"

            Method insert_baseline_rows has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def insert_baseline_rows(leaderboard_type:)
                post_challenge, cuttoff_dttm = leaderboard_params(leaderboard_type: leaderboard_type)
                sql = %Q[
                  INSERT INTO base_leaderboards (
                    id,
            Severity: Major
            Found in app/services/calculate_leaderboard_service.rb - About 2 hrs to fix

              Method create has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create #POST
                  Rails.logger.info "[api] Api::ExternalGradersController#create"
                  Rails.logger.info "[api] params: #{params}"
                  message = nil
                  status = nil
              Severity: Major
              Found in app/controllers/api/external_graders_controller.rb - About 2 hrs to fix

                Method update has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def update #PATCH
                    Rails.logger.info "[api] Api::ExternalGradersController#update"
                    Rails.logger.info "[api] params: #{params}"
                    message = nil
                    status = nil
                Severity: Major
                Found in app/controllers/api/external_graders_controller.rb - About 2 hrs to fix

                  Method create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create #POST
                      Rails.logger.info "[api] Api::ExternalGradersController#create"
                      Rails.logger.info "[api] params: #{params}"
                      message = nil
                      status = nil
                  Severity: Minor
                  Found in app/controllers/api/external_graders_controller.rb - About 2 hrs 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

                  Method change has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def change
                      drop_view :participant_challenges
                      create_view :participant_challenges, "
                      SELECT p.id,
                             pc.challenge_id,    -- fk to challenges
                  Severity: Major
                  Found in doc/technical/archived_migrations/20160609145519_fix_view_bug.rb - About 2 hrs to fix

                    Method change has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def change
                        drop_view :participant_challenges
                        create_view :participant_challenges, "
                        SELECT p.id,
                               pc.challenge_id,    -- fk to challenges
                    Severity: Major
                    Found in doc/technical/archived_migrations/20160609134105_refactor_views2.rb - About 2 hrs to fix

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

                        def day
                          submissions = @challenge
                            .submissions
                            .where(
                                "participant_id = ? and created_at >= ?",
                      Severity: Major
                      Found in app/queries/submissions_remaining_query.rb and 1 other location - About 2 hrs to fix
                      app/queries/submissions_remaining_query.rb on lines 59..90

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

                      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

                        def week
                          submissions = @challenge
                            .submissions
                            .where(
                              "participant_id = ? and created_at >= ?", @participant_id,
                      Severity: Major
                      Found in app/queries/submissions_remaining_query.rb and 1 other location - About 2 hrs to fix
                      app/queries/submissions_remaining_query.rb on lines 24..56

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

                      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

                      Method change has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def change
                          create_view :participant_challenges,
                          "
                          SELECT c.id,
                                 c.id AS challenge_id,

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

                          closeSidebar(e) {
                            e.preventDefault();
                            this.openTarget.classList.remove('display-none');
                            this.closeTarget.classList.add('display-none');
                            this.sidebarTarget.classList.add('display-none');
                        app/javascript/stimulus_js/controllers/filter_sidebar_controller.js on lines 6..11

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

                        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

                              $.ajax({
                                url: '/dataset_files/' + dataset_file_id + '/dataset_file_downloads',
                                type: 'POST',
                                complete: function() { console.log('file download logged')},
                                error: function() { console.log('file download errored ' + status)}
                        app/assets/javascripts/controllers/task_dataset_files_controller.js on lines 7..12

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

                        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

                          openSidebar(e) {
                            e.preventDefault();
                            this.openTarget.classList.add('display-none');
                            this.closeTarget.classList.remove('display-none');
                            this.sidebarTarget.classList.remove('display-none');
                        app/javascript/stimulus_js/controllers/filter_sidebar_controller.js on lines 13..18

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

                        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

                              $.ajax({
                                url: '/task_dataset_files/' + dataset_file_id + '/task_dataset_file_downloads',
                                type: 'POST',
                                complete: function() { console.log('file download logged')},
                                error: function() { console.log('file download errored ' + status)}
                        app/assets/javascripts/controllers/dataset_files_controller.js 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 76.

                        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