twitter/clockworkraven

View on GitHub

Showing 39 of 66 total issues

Function slide has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  , slide: function (type, next) {
      var $active = this.$element.find('.active')
        , $next = next || $active[type]()
        , isCycling = this.interval
        , direction = type == 'next' ? 'left' : 'right'
Severity: Minor
Found in app/assets/javascripts/lib/bootstrap.js - About 1 hr to fix

    Method create has 33 lines of code (exceeds 25 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

      Function _handleData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _handleData: function(data) {
              // update progress bar and text
              $('#progress_bar').css('width', data.percentage + '%');
              $('.completed').text(data.completed);
              $('.total').text(data.total);
      Severity: Minor
      Found in app/assets/javascripts/job.js - About 1 hr to fix

        Method update has 30 lines of code (exceeds 25 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

          Function _fnAddButtons has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              "_fnAddButtons": function ()
              {
                  var
                      nButton,
                      sExclude = ","+this.s.aiExclude.join(',')+",";
          Severity: Minor
          Found in app/assets/javascripts/lib/ColVis.js - About 1 hr to fix

            Method responses_csv has 30 lines of code (exceeds 25 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 1 hr to fix

              Function _handleData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  _handleData: function(data) {
                      // update progress bar and text
                      $('#progress_bar').css('width', data.percentage + '%');
                      $('.completed').text(data.completed);
                      $('.total').text(data.total);
              Severity: Minor
              Found in app/assets/javascripts/job.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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  current_user.name  = params[:user][:name]  unless params[:user][:name].nil?
                  current_user.email = params[:user][:email] unless params[:user][:email].nil?
              
                  unless params[:user][:password].blank?
              Severity: Minor
              Found in app/controllers/users_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 setupButtons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  setupButtons: function(name, posSelector, negSelector, controlsSelector, spinnerSelector, positiveResponse) {
                      $(posSelector).add(negSelector).bind('ajax:before', function() {
                          // fade out the controls and fade in a spinner while we're loading
                          // the response
                          console.log(name, 'starting request');
              Severity: Minor
              Found in app/assets/javascripts/task_responses.js - About 1 hr to fix

                Method mturk_run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def mturk_run &block
                      init_if_needed
                      retries = 0
                
                      begin
                Severity: Minor
                Found in lib/m_turk_utils.rb - About 55 mins 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 setupButtons has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    setupButtons: function(name, posSelector, negSelector, controlsSelector, spinnerSelector, positiveResponse) {
                Severity: Minor
                Found in app/assets/javascripts/task_responses.js - About 45 mins to fix

                  Method link_to_add_fields has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def link_to_add_fields(name, icon, f, association, link_classes = '', create_children=nil)
                  Severity: Minor
                  Found in app/helpers/evaluations_helper.rb - About 45 mins to fix

                    Method auth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def auth username, password
                        return nil unless @access_users.member?(username)
                    
                        dn = dn_for username
                        @ldap.auth dn, password
                    Severity: Minor
                    Found in lib/ldap_auth.rb - About 35 mins 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

                    Avoid too many return statements within this method.
                    Open

                          return :accounts
                    Severity: Major
                    Found in app/helpers/application_helper.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                            return :other
                      Severity: Major
                      Found in app/helpers/application_helper.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return :jobs
                        Severity: Major
                        Found in app/helpers/application_helper.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                return :login
                          Severity: Major
                          Found in app/helpers/application_helper.rb - About 30 mins to fix

                            Function updateChart has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                updateChart: function() {
                                    // copy default options
                                    var options = $.extend(true, {}, TaskResponses.barChartOptions);
                            
                                    // which question are we charting?
                            Severity: Minor
                            Found in app/assets/javascripts/task_responses.js - About 25 mins 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 force_expire has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def force_expire task
                                  hit_id = task.mturk_hit
                                  return unless hit_id
                            
                                  begin
                            Severity: Minor
                            Found in lib/m_turk_utils.rb - About 25 mins 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