vegantech/sims

View on GitHub

Showing 433 of 433 total issues

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

function clearSuggestions() {
    var slct = this.suggestionList;
    for( var j = slct.length - 1; j > -1; j-- ) {
        if( slct.options[j] ) {
            slct.options[j] = null;
Severity: Major
Found in app/assets/javascripts/spellerpages/controlWindow.js and 1 other location - About 2 hrs to fix
public/speller/controlWindow.js on lines 63..70

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

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

                try {
                        if( obj.detachEvent ) {
                                obj.detachEvent( "on"+type, obj[type+fn] );
                                obj[type+fn] = null;
                        } else {
Severity: Major
Found in app/assets/javascripts/tablesort.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/datepicker.js on lines 1217..1224

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

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

                var dateTest = [
                        { regExp:/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, d:1, m:3, y:5 },  // dmy
                        { regExp:/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, d:3, m:1, y:5 },  // mdy
                        { regExp:/^(\d\d\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,    d:5, m:3, y:1 }   // ymd
                        ];
Severity: Major
Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/tablesort.js on lines 707..711

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

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

                var dateTest = [
                        { regExp:/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, d:3, m:1, y:5 },  // mdy
                        { regExp:/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, d:1, m:3, y:5 },  // dmy
                        { regExp:/^(\d\d\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, d:5, m:3, y:1 }      // ymd
                        ];
Severity: Major
Found in app/assets/javascripts/tablesort.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/datepicker.js on lines 1265..1269

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

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 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 public/speller/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 app/assets/javascripts/spellerpages/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

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

                  function removeFocus( textIndex, wordIndex ) {
                      var word = this._getWordObject( textIndex, wordIndex );
                      if( word ) {
                          if( word.type == "text" ) {
                              word.blur();
                  Severity: Major
                  Found in app/assets/javascripts/spellerpages/wordWindow.js and 3 other locations - About 2 hrs to fix
                  app/assets/javascripts/spellerpages/wordWindow.js on lines 89..97
                  public/speller/wordWindow.js on lines 89..97
                  public/speller/wordWindow.js on lines 99..107

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

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

                  function setFocus( textIndex, wordIndex ) {
                      var word = this._getWordObject( textIndex, wordIndex );
                      if( word ) {
                          if( word.type == "text" ) {
                              word.focus();
                  Severity: Major
                  Found in public/speller/wordWindow.js and 3 other locations - About 2 hrs to fix
                  app/assets/javascripts/spellerpages/wordWindow.js on lines 89..97
                  app/assets/javascripts/spellerpages/wordWindow.js on lines 99..107
                  public/speller/wordWindow.js on lines 99..107

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

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

                  function removeFocus( textIndex, wordIndex ) {
                      var word = this._getWordObject( textIndex, wordIndex );
                      if( word ) {
                          if( word.type == "text" ) {
                              word.blur();
                  Severity: Major
                  Found in public/speller/wordWindow.js and 3 other locations - About 2 hrs to fix
                  app/assets/javascripts/spellerpages/wordWindow.js on lines 89..97
                  app/assets/javascripts/spellerpages/wordWindow.js on lines 99..107
                  public/speller/wordWindow.js on lines 89..97

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

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

                  function setFocus( textIndex, wordIndex ) {
                      var word = this._getWordObject( textIndex, wordIndex );
                      if( word ) {
                          if( word.type == "text" ) {
                              word.focus();
                  Severity: Major
                  Found in app/assets/javascripts/spellerpages/wordWindow.js and 3 other locations - About 2 hrs to fix
                  app/assets/javascripts/spellerpages/wordWindow.js on lines 99..107
                  public/speller/wordWindow.js on lines 89..97
                  public/speller/wordWindow.js on lines 99..107

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

                  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 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
                      Severity
                      Category
                      Status
                      Source
                      Language