vegantech/sims

View on GitHub

Showing 433 of 433 total issues

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

    Method group_by_cluster_and_objective has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.group_by_cluster_and_objective(params ={})
        #This will work better
    
        #refactor this to use recommended monitors?
        probes = find(:all, :order =>"active desc, custom, position", :include => [{:intervention_definitions=>{:intervention_cluster=>:objective_definition}},:intervention_probe_assignments, :recommended_monitors])
    Severity: Minor
    Found in app/models/probe_definition.rb - About 1 hr to fix

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

              redraw: function(tableid, identical) {
                      if(!tableid || !(tableid in fdTableSort.tableCache)) { return; };
                      var dataObj     = fdTableSort.tableCache[tableid];
                      var data        = dataObj.data;
                      var len1        = data.length;
      Severity: Minor
      Found in app/assets/javascripts/tablesort.js - About 1 hr to fix

        Method create_with_schools_and_users has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.create_with_schools_and_users(abbrev,name)
            td=District.create!(:abbrev=>abbrev, :name =>name, :forgot_password => true)
            ActiveRecord::Base.transaction do
            td.send :create_admin_user
            #alpha elementary
        Severity: Minor
        Found in lib/create_training_district.rb - About 1 hr to fix

          Function jsWrapper has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  jsWrapper: function(tableid, colNums) {
                          if(!(tableid in fdTableSort.tmpCache)) { return false; };
                          if(!(tableid in fdTableSort.tableCache)) { fdTableSort.prepareTableData(document.getElementById(tableid)); };
                          if(!(colNums instanceof Array)) { colNums = [colNums]; };
          
          Severity: Minor
          Found in app/assets/javascripts/tablesort.js - About 1 hr to fix

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

            function _setWordText( text_num, word_num, newText, flag ) {
                // set the UI and form inputs
                this.wordWin.setText( text_num, word_num, newText );
                // keep track of what happened to this word:
                this.wordFlags[text_num][word_num] = flag;
            Severity: Major
            Found in app/assets/javascripts/spellerpages/spellChecker.js and 1 other location - About 1 hr to fix
            public/speller/spellChecker.js on lines 430..436

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

            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

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

            function _setWordText( text_num, word_num, newText, flag ) {
                // set the UI and form inputs
                this.wordWin.setText( text_num, word_num, newText );
                // keep track of what happened to this word:
                this.wordFlags[text_num][word_num] = flag;
            Severity: Major
            Found in public/speller/spellChecker.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/spellerpages/spellChecker.js on lines 440..446

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

            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

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

            Popup.prototype.hide = function() {
                // If this was a temp object creating on-the-fly, then remove objects from the DOM so
                // The document doesn't get littered with extra objects
                if (this.destroyDivOnHide) {
                    DOM.removeNode(this.div);
            Severity: Minor
            Found in app/assets/javascripts/popup.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 link_to_if_authorized has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def link_to_if_authorized(name, options = {}, html_options = {}, *rest)
                #TODO Test then Refactor!!!     This is a spike.
               # hsh = ::ActionController::Routing::Routes.recognize_path url.gsub(/\?.*$/,''), :method=> :get
                if options.is_a?String
                  url = options
            Severity: Minor
            Found in app/helpers/application_helper.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 replaceAll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function replaceAll() {
                var ti = this.currentTextIndex;
                var wi = this.currentWordIndex;
                if( !this.wordWin ) {
                    alert( 'Error: Word frame not available.' );
            Severity: Minor
            Found in app/assets/javascripts/spellerpages/spellChecker.js - About 1 hr to fix

              Function replaceAll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function replaceAll() {
                  var ti = this.currentTextIndex;
                  var wi = this.currentWordIndex;
                  if( !this.wordWin ) {
                      alert( 'Error: Word frame not available.' );
              Severity: Minor
              Found in public/speller/spellChecker.js - About 1 hr to fix

                Function getEnabledDates has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        o.getEnabledDates = function(y, m) {
                                var obj = {};
                                var d = datePicker.getDaysPerMonth(m - 1, y);
                                m = m < 10 ? "0" + String(m) : m;
                                var day,tmp,de,me,ye,disabled;
                Severity: Minor
                Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

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

                                  document.getElementById(o.id + "-today-but").className = document.getElementById(o.id + "-today-but").className.replace("fd-disabled", "");
                  Severity: Major
                  Found in app/assets/javascripts/datepicker.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/datepicker.js on lines 288..288

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

                  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

                                          document.getElementById(o.id+"-date-picker-hover").className = document.getElementById(o.id+"-date-picker-hover").className.replace("date-picker-hover", "");
                  Severity: Major
                  Found in app/assets/javascripts/datepicker.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/datepicker.js on lines 898..898

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

                  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

                  Function _spellcheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function _spellcheck() {
                      var ww = this.wordWin;
                      
                      // check if this is the last word in the current text element
                      if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
                  Severity: Minor
                  Found in public/speller/spellChecker.js - About 1 hr to fix

                    Function addScreen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Popup.prototype.addScreen = function() {
                        if (this.screen==null) {
                            this.screen = this.createDiv();
                            this.screen.style.top="0px";
                            this.screen.style.left="0px";
                    Severity: Minor
                    Found in app/assets/javascripts/popup.js - About 1 hr to fix

                      Function _spellcheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function _spellcheck() {
                          var ww = this.wordWin;
                          
                          // check if this is the last word in the current text element
                          if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
                      Severity: Minor
                      Found in app/assets/javascripts/spellerpages/spellChecker.js - About 1 hr to fix

                        Method flags has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.flags
                            pids = `ps wx |grep -v grep |grep 'runner' |grep 'PrimeCache'| grep -v 'nice' |cut -f 1 -d' '`
                            if pids.split("\n").size > 1
                              puts "Script already running"
                              exit 0
                        Severity: Minor
                        Found in lib/prime_cache.rb - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                                  if(inp.className && (inp.className.search(regExp6) != -1 || inp.className.search(/split-date/) != -1) && ((inp.tagName.toLowerCase() == "input" && (inp.type == "text" || inp.type == "hidden")) || inp.tagName.toLowerCase() == "select")) {
                          
                                                          if(inp.id && document.getElementById('fd-'+inp.id)) { continue; };
                                                          
                                                          if(!inp.id) { inp.id = "fdDatePicker-" + uniqueId++; };
                          Severity: Major
                          Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

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

                            function _setAsIgnored( text_num, word_num, flag ) {
                                // set the UI
                                this.wordWin.removeFocus( text_num, word_num );
                                // do the bookkeeping
                                this.wordFlags[text_num][word_num] = flag;
                            Severity: Major
                            Found in public/speller/spellChecker.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/spellerpages/spellChecker.js on lines 418..424

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

                            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