crowdAI/crowdai

View on GitHub

Showing 97 of 178 total issues

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,

    Function innerSortFunction has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              dean_addEvent(headrow[i],"click", sorttable.innerSortFunction = function(e) {
    
              if (this.className.search(/\bsorttable_sorted\b/) != -1) {
                // if we're already sorted by this column, just
                // reverse the table, which is quicker
    Severity: Minor
    Found in app/assets/javascripts/modules/sorttable.js - About 2 hrs to fix

      Method update has a Cognitive Complexity of 15 (exceeds 5 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: Minor
      Found in app/controllers/api/external_graders_controller.rb - 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 guessType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        guessType: function(table, column) {
          // guess the type of a column based on its first non-blank row
          sortfn = sorttable.sort_alpha;
          for (var i=0; i<table.tBodies[0].rows.length; i++) {
            text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
      Severity: Minor
      Found in app/assets/javascripts/modules/sorttable.js - 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

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

        def change
          create_table :oauth_applications do |t|
            t.string  :name,         null: false
            t.string  :uid,          null: false
            t.string  :secret,       null: false

        Method change has 44 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: Minor
        Found in doc/technical/archived_migrations/20160609133503_refactor_views.rb - About 1 hr to fix

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

            getInnerText: function(node) {
              // gets the text we want to use for sorting for a cell.
              // strips leading and trailing whitespace.
              // this is *not* a generic getInnerText function; it's special to sorttable.
              // for example, you can override the cell text with a customkey attribute.
          Severity: Minor
          Found in app/assets/javascripts/modules/sorttable.js - 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

          Method submissions_allowed? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            def submissions_allowed?
              return false unless @record.online_submissions
              if participant && (participant.admin? || @record.organizer_id == participant.organizer_id)
                return true
              end
          Severity: Minor
          Found in app/policies/challenge_policy.rb - 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

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

            def change
              execute "update submissions set media_content_type = 'video/mp4', media_large = '3382.mp4' where id = 3382;"
          execute "update submissions set media_content_type = 'video/mp4', media_thumbnail = '3382.thumb.mp4' where id = 3382;"
          execute "update submissions set media_content_type = 'video/mp4', media_large = '3395.mp4' where id = 3395;"
          execute "update submissions set media_content_type = 'video/mp4', media_thumbnail = '3395.thumb.mp4' where id = 3395;"
          Severity: Minor
          Found in doc/technical/archived_migrations/20171212102835_conv_videos.rb - About 1 hr to fix

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

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

              Function edit has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                edit: function(){
                  emailFrequencyVisiblity();
              
                  // checkboxes cannot be directly checked off
                  $('#email_preference_receive_every_email,#email_preference_receive_daily_digest,#email_preference_receive_weekly_digest').each(function(){
              Severity: Minor
              Found in app/assets/javascripts/controllers/email_preferences_controller.js - About 1 hr to fix

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

                  def change
                    add_column :article_sections, :slug, :string
                    add_index :article_sections, :slug, unique: true
                
                    add_column :articles, :slug, :string

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

                    shaker_sort: function(list, comp_func) {
                      // A stable sort function to allow multi-level sorting of data
                      // see: http://en.wikipedia.org/wiki/Cocktail_sort
                      // thanks to Joseph Nahmias
                      var b = 0;
                  Severity: Minor
                  Found in app/assets/javascripts/modules/sorttable.js - 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

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

                    def change
                      drop_view :leaderboards
                      rename_table :users, :participants
                      rename_table :team_users, :team_participants
                      rename_column :team_participants, :user_id, :participant_id

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

                      def change
                        drop_view :leaderboards
                        remove_column :submissions, :evaluated
                        create_view :leaderboards,
                        "

                      Method index has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def index
                          @current_round_id = current_round_id
                          if params[:baselines] == 'on'
                            @search = policy_scope(Submission)
                              .where(
                      Severity: Minor
                      Found in app/controllers/submissions_controller.rb - About 1 hr to fix

                        Function getInnerText has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          getInnerText: function(node) {
                            // gets the text we want to use for sorting for a cell.
                            // strips leading and trailing whitespace.
                            // this is *not* a generic getInnerText function; it's special to sorttable.
                            // for example, you can override the cell text with a customkey attribute.
                        Severity: Minor
                        Found in app/assets/javascripts/modules/sorttable.js - About 1 hr to fix

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

                            def change
                              drop_view :leaderboards
                              drop_table :team_participants
                              remove_column :submissions, :team_id
                              drop_table :teams
                          Severity: Minor
                          Found in doc/technical/archived_migrations/20160502081246_remove_teams.rb - About 1 hr to fix

                            Method day has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def day
                                submissions = @challenge
                                  .submissions
                                  .where(
                                      "participant_id = ? and created_at >= ?",
                            Severity: Minor
                            Found in app/queries/submissions_remaining_query.rb - About 1 hr to fix

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

                              function dean_addEvent(element, type, handler) {
                                  if (element.addEventListener) {
                                      element.addEventListener(type, handler, false);
                                  } else {
                                      // assign each event handler a unique ID
                              Severity: Minor
                              Found in app/assets/javascripts/modules/sorttable.js - 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