crowdAI/crowdai

View on GitHub

Showing 178 of 178 total issues

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

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

            class Scope
              attr_reader :participant, :scope
          
              def initialize(participant, scope)
                @participant = participant
          Severity: Major
          Found in app/policies/submission_policy.rb and 2 other locations - About 1 hr to fix
          app/policies/leaderboard_policy.rb on lines 22..75
          app/policies/ongoing_leaderboard_policy.rb on lines 3..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 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 3 locations. Consider refactoring.
          Open

            class Scope
              attr_reader :participant, :scope
          
              def initialize(participant, scope)
                @participant = participant
          Severity: Major
          Found in app/policies/ongoing_leaderboard_policy.rb and 2 other locations - About 1 hr to fix
          app/policies/leaderboard_policy.rb on lines 22..75
          app/policies/submission_policy.rb on lines 46..100

          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 3 locations. Consider refactoring.
          Open

            class Scope
              attr_reader :participant, :scope
          
              def initialize(participant, scope)
                @participant = participant
          Severity: Major
          Found in app/policies/leaderboard_policy.rb and 2 other locations - About 1 hr to fix
          app/policies/ongoing_leaderboard_policy.rb on lines 3..56
          app/policies/submission_policy.rb on lines 46..100

          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

          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

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

                    toggleFrequency(event){
                      if(event.target.checked) {
                        this.frequencyTarget.style.display = 'block';
                      } else {
                        this.frequencyTarget.style.display = 'none';
                  app/javascript/stimulus_js/controllers/submission_baseline_controller.js on lines 15..21

                  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

                    toggleBaseline(event){
                      if(event.target.checked) {
                        this.baselineCommentTarget.style.display = 'block';
                      } else {
                        this.baselineCommentTarget.style.display = 'none';
                  app/javascript/stimulus_js/controllers/email_preferences_controller.js on lines 14..20

                  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

                  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,
                      "

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

                      hideSection() {
                        this.expandTarget.classList.remove('display-none');
                        this.collapseTarget.classList.add('display-none');
                        this.sectionTarget.classList.add('display-none');
                      }
                    app/javascript/stimulus_js/controllers/expanding_section_controller.js on lines 6..10

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

                    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