vegantech/sims

View on GitHub

Showing 223 of 433 total issues

File ie-console.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Simple Javascript console for IE
 *
 * Inspired by Firebug for Firefox
 *
Severity: Minor
Found in app/assets/javascripts/ie-console.js - About 2 hrs to fix

    Function get has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        pos.get = function(o) {
            var fixBrowserQuirks = true;
                // If a string is passed in instead of an object ref, resolve it
            if (typeof(o)=="string") {
                o = resolveObject(o);
    Severity: Major
    Found in app/assets/javascripts/popup.js - About 2 hrs to fix

      Class Base has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class ProbeGraph::Base
        require 'probe_graph/html'
        include ProbeGraph::HTML
        attr_reader :benchmarks, :title, :goal
      
      
      Severity: Minor
      Found in app/models/probe_graph/base.rb - About 2 hrs to fix

        Class Students has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Students < CSVImporter::Base
            #13.1196098327637 seconds of overhead for preprocessing the csv and loading into the temporary table (and indexing)
            #19.3717708587646,
        =begin
            def import
        Severity: Minor
        Found in lib/csv_importer/students.rb - About 2 hrs to fix

          Function Sort has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          })();var Sort = (function(){
              var sort = {};
              sort.AlphaNumeric = function(a,b) {
                  if (a==b) { return 0; }
                  if (a<b) { return -1; }
          Severity: Major
          Found in app/assets/javascripts/popup.js - About 2 hrs to fix

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

              def process_row line
                student= check_student(line[:district_student_id]) or return false
                int_def=check_intervention_definition(line[:intervention_definition_id]) or return false
            
                intervention=int_def.interventions.build(:student => student, :user => @user, :start_date => line[:start_date],
            Severity: Minor
            Found in lib/automated_intervention.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 links_and_attachments has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              def links_and_attachments(obj, tag_type)
                return "" unless obj.respond_to? "assets"
                obj.assets.inject("") do |str,asset|
                  str += content_tag(tag_type, link_to_with_icon(asset.name, asset.url)) unless asset.url.blank? or asset.destroyed?
                  if asset.document?
            Severity: Minor
            Found in app/helpers/links_and_attachments_helper.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 handleRemote has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                handleRemote: function(element) {
                  var method, url, data, elCrossDomain, crossDomain, withCredentials, dataType, options;
            
                  if (rails.fire(element, 'ajax:before')) {
                    elCrossDomain = element.data('cross-domain');
            Severity: Major
            Found in app/assets/javascripts/jquery_ujs.js - About 2 hrs to fix

              File unobtrusive_date_picker.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module UnobtrusiveDatePicker
                
                DATEPICKER_DEFAULT_NAME_ID_SUFFIXES = { :year  => {:id => '',   :name => 'year'},
                                                        :month => {:id => 'mm', :name => 'month'},
                                                        :day   => {:id => 'dd', :name => 'day'} }
              Severity: Minor
              Found in lib/unobtrusive_date_picker/unobtrusive_date_picker.rb - About 2 hrs to fix

                Function undo has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function undo() {
                    // skip if this is the first word!
                    var ti = this.currentTextIndex;
                    var wi = this.currentWordIndex
                    
                Severity: Major
                Found in app/assets/javascripts/spellerpages/spellChecker.js - About 2 hrs to fix

                  Function undo has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function undo() {
                      // skip if this is the first word!
                      var ti = this.currentTextIndex;
                      var wi = this.currentWordIndex
                      
                  Severity: Major
                  Found in public/speller/spellChecker.js - About 2 hrs to fix

                    File jquery_ujs.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    (function($, undefined) {
                    
                    /**
                     * Unobtrusive scripting adapter for jQuery
                     * https://github.com/rails/jquery-ujs
                    Severity: Minor
                    Found in app/assets/javascripts/jquery_ujs.js - About 2 hrs to fix

                      IEConsole has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      var IEConsole = {
                          HEIGHT: 120,
                          INPUT_HEIGHT: 25,
                          block: false,
                          open: false,
                      Severity: Minor
                      Found in app/assets/javascripts/ie-console.js - About 2 hrs to fix

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

                            formatResult: function(result) {
                                var type = IEConsole.getType(result);
                                try {
                                    // DOM Element
                                    if (type == 'DOMElement') {
                        Severity: Major
                        Found in app/assets/javascripts/ie-console.js - About 2 hrs to fix

                          File district.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class District < ActiveRecord::Base
                          
                          #  ActiveSupport::Dependencies.load_missing_constant self, :StudentsController
                            SETTINGS = [:key, :previous_key, :custom_interventions ]
                            BOOLEAN_SETTINGS = [:restrict_free_lunch, :forgot_password, :lock_tier, :email_on_team_consultation_response, :show_team_consultations_if_pending]
                          Severity: Minor
                          Found in app/models/district.rb - About 2 hrs to fix

                            Method ajax_probe_assignment has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def ajax_probe_assignment
                                @intervention = current_student.interventions.find_by_id(params[:intervention_id]) || Intervention.new
                                if params[:id] == 'custom'
                                  @intervention_probe_assignment = @intervention.intervention_probe_assignments.build if @intervention
                                  if @intervention_probe_assignment and  @intervention_probe_assignment.probe_definition.blank?
                            Severity: Minor
                            Found in app/controllers/interventions_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 make_date_picker_class_options has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def make_date_picker_class_options(options)
                                  html_classes = []
                            
                                  if options[:highlight_days]
                                    highlight_days = parse_days_of_week(options[:highlight_days])
                            Severity: Minor
                            Found in lib/unobtrusive_date_picker/unobtrusive_date_picker.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 dates_of_sims_data has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def dates_of_sims_data
                            
                            
                                referrals= Student.connection.select_all("select distinct s.district_student_id,r.id, r.created_at, (year(r.updated_at + INTERVAL 6 month))  as schoolyear
                                from students s inner join recommendations r on r.student_id = s.id and r.promoted=true and r.recommendation=5
                            Severity: Major
                            Found in lib/referral_report.rb - About 2 hrs to fix

                              Function addThNode has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      addThNode: function() {
                                              var dataObj = fdTableSort.tableCache[fdTableSort.tableId];
                                              var pos     = fdTableSort.thNode.className.match(/fd-column-([0-9]+)/)[1];
                                              var alt     = false;
                              
                              Severity: Major
                              Found in app/assets/javascripts/tablesort.js - About 2 hrs to fix

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

                                var PopupEvent = (function(){
                                    var ev = {};
                                    
                                    // Resolve an event using IE's window.event if necessary
                                    // --------------------------------------------------------------------
                                Severity: Minor
                                Found in app/assets/javascripts/popup.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language