twitter/clockworkraven

View on GitHub

Showing 39 of 66 total issues

File bootstrap.js has 1281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* ===================================================
 * bootstrap-transition.js v2.0.4
 * http://twitter.github.com/bootstrap/javascript.html#transitions
 * ===================================================
 * Copyright 2012 Twitter, Inc.
Severity: Major
Found in app/assets/javascripts/lib/bootstrap.js - About 3 days to fix

    File ColVis.js has 484 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * File:        ColVis.js
     * Version:     1.0.7
     * CVS:         $Id$
     * Description: Controls for column visiblity in DataTables
    Severity: Minor
    Found in app/assets/javascripts/lib/ColVis.js - About 7 hrs to fix

      Method fetch_results has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def fetch_results task
            hit_id = task.mturk_hit
            return unless hit_id
            assignments = mturk_run{mturk(task.evaluation).getAssignmentsForHIT :HITId => hit_id}
            # return if we don't have a response from a MTurk user
      Severity: Minor
      Found in lib/m_turk_utils.rb - About 3 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

      File m_turk_utils.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module MTurkUtils
        # Basic structure of the XML structure for an HTML question.
        HTML_QUESTION_XML = <<-END_XML
          <HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
            <HTMLContent><![CDATA[
      Severity: Minor
      Found in lib/m_turk_utils.rb - About 3 hrs to fix

        Method update_template has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_template
            params[:evaluation] ||= {}
        
            if @evaluation.tasks.size > 0
              @fields = @evaluation.tasks.first.data.keys
        Severity: Minor
        Found in app/controllers/evaluations_controller.rb - About 3 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

        Function updateChart has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            updateChart: function() {
                // copy default options
                var options = $.extend(true, {}, TaskResponses.barChartOptions);
        
                // which question are we charting?
        Severity: Major
        Found in app/assets/javascripts/task_responses.js - About 3 hrs to fix

          Function _fnCollectionShow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              "_fnCollectionShow": function ()
              {
                  var that = this, i, iLen;
                  var oPos = $(this.dom.button).offset();
                  var nHidden = this.dom.collection;
          Severity: Major
          Found in app/assets/javascripts/lib/ColVis.js - About 2 hrs to fix

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

              def index
                @eval = Evaluation.includes({
                  :task_responses => {:mc_question_responses => [:mc_question_option], :fr_question_responses => [], :task => [], :m_turk_user => []},
                  :fr_questions => [:fr_question_responses],
                  :mc_questions => {:mc_question_options => [:mc_question_responses => [:mc_question_option]]}
            Severity: Major
            Found in app/controllers/task_responses_controller.rb - About 2 hrs to fix

              Method responses_csv has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                def responses_csv(sep = ',')
                  CSV.generate(:col_sep => sep) do |csv|
                    # Pull out the fields that were uploaded with the original data,
                    # so that we can output these along with the task responses.
                    orig_fields_keys = if @task_responses.empty? 
              Severity: Minor
              Found in app/controllers/task_responses_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 thread_pool has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def Threading.thread_pool items, size=16, retry_count=3, &processor
                  queue = Queue.new
                  items.each {|o| queue.push o}
                  threads = []
                  results = []
              Severity: Minor
              Found in lib/threading.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

              Function _fnApplyCustomisation has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  "_fnApplyCustomisation": function ()
                  {
                      var oConfig = this.s.oInit;
              
                      if ( typeof oConfig.activate != 'undefined' )
              Severity: Major
              Found in app/assets/javascripts/lib/ColVis.js - About 2 hrs to fix

                Method sync_users has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def sync_users
                      init_if_needed
                
                      # get rid of existing lists
                      MTurkUser.where('prod = 1 AND ((banned = 1) OR (trusted = 1))').each do |u|
                Severity: Minor
                Found in lib/m_turk_utils.rb - About 1 hr to fix

                  Method fetch_results has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def fetch_results task
                        hit_id = task.mturk_hit
                        return unless hit_id
                        assignments = mturk_run{mturk(task.evaluation).getAssignmentsForHIT :HITId => hit_id}
                        # return if we don't have a response from a MTurk user
                  Severity: Minor
                  Found in lib/m_turk_utils.rb - About 1 hr to fix

                    Method update_template has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def update_template
                        params[:evaluation] ||= {}
                    
                        if @evaluation.tasks.size > 0
                          @fields = @evaluation.tasks.first.data.keys
                    Severity: Minor
                    Found in app/controllers/evaluations_controller.rb - About 1 hr to fix

                      Function show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        , show: function () {
                            var $tip
                              , inside
                              , pos
                              , actualWidth
                      Severity: Minor
                      Found in app/assets/javascripts/lib/bootstrap.js - About 1 hr to fix

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

                          def create
                            if params[:based_on]
                              @evaluation = Evaluation.based_on(Evaluation.find(params[:based_on]))
                              @evaluation.attributes = params[:evaluation]
                            else
                        Severity: Minor
                        Found in app/controllers/evaluations_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

                        Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update
                            @evaluation.attributes = params[:evaluation]
                        
                            # parse data
                            data = nil
                        Severity: Minor
                        Found in app/controllers/evaluations_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 _fnDomColumnButton has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            "_fnDomColumnButton": function ( i )
                            {
                                var
                                    that = this,
                                    oColumn = this.s.dt.aoColumns[i],
                        Severity: Minor
                        Found in app/assets/javascripts/lib/ColVis.js - About 1 hr to fix

                          Method sync_users has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def sync_users
                                init_if_needed
                          
                                # get rid of existing lists
                                MTurkUser.where('prod = 1 AND ((banned = 1) OR (trusted = 1))').each do |u|
                          Severity: Minor
                          Found in lib/m_turk_utils.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 thread_pool has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def Threading.thread_pool items, size=16, retry_count=3, &processor
                              queue = Queue.new
                              items.each {|o| queue.push o}
                              threads = []
                              results = []
                          Severity: Minor
                          Found in lib/threading.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language