vegantech/sims

View on GitHub

Showing 433 of 433 total issues

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

function _lastPos( txtid, idx ) {
    if( idx > 0 )
        return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length;
    else
        return 0;
Severity: Major
Found in app/assets/javascripts/spellerpages/wordWindow.js and 1 other location - About 1 hr to fix
public/speller/wordWindow.js on lines 211..216

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

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 getType has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    getType: function(value) {
        var self = IEConsole;
        var type = typeof value;
        try {
            if (type == "undefined") {
Severity: Minor
Found in app/assets/javascripts/ie-console.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

Function destroy has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        o.destroy = function() {
                // Cleanup for Internet Explorer
                datePickerController.removeEvent(o.staticPos ? o.table : document, "mousedown", o.events.onmousedown);
                datePickerController.removeEvent(document, "mouseup",   o.events.clearTimer);
                o.removeKeyboardEvents();
Severity: Minor
Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

    Function getType has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getType: function(value) {
            var self = IEConsole;
            var type = typeof value;
            try {
                if (type == "undefined") {
    Severity: Minor
    Found in app/assets/javascripts/ie-console.js - About 1 hr to fix

      Function writeBody has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function writeBody() {
          var d = window.document;
          var is_html = false;
      
          d.open();
      Severity: Minor
      Found in public/speller/wordWindow.js - About 1 hr to fix

        Function returnFormattedDate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                o.returnFormattedDate = function() {
        
                        var elem = o.getElem();
                        if(!elem) return;
                        
        Severity: Minor
        Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

          Function writeBody has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function writeBody() {
              var d = window.document;
              var is_html = false;
          
              d.open();
          Severity: Minor
          Found in app/assets/javascripts/spellerpages/wordWindow.js - About 1 hr to fix

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

              def index
                #TODO test and refactor
                flash[:notice]=nil
            
                @without=params[:without]
            Severity: Minor
            Found in app/controllers/stats_controller.rb - About 1 hr to fix

              Method add_extended_profile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.add_extended_profile(student)
                  FactoryGirl.create :ext_summary, student: student
                  FactoryGirl.create :ext_adult_contact, student: student
                  FactoryGirl.create :ext_sibling, student: student
                  student.ext_test_scores.create!( [
              Severity: Minor
              Found in lib/training_district/student.rb - About 1 hr to fix

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

                    if (top-scrollTop+height>clientHeight) {
                        top = top - ((top+height) - (scrollTop+clientHeight));
                        this.div.style.top = top + "px";
                    }
                Severity: Major
                Found in app/assets/javascripts/popup.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/popup.js on lines 1184..1187

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

                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

                    if (left-scrollLeft+width>clientWidth) {
                        left = left - ((left+width) - (scrollLeft+clientWidth));
                        this.div.style.left = left + "px";
                    }
                Severity: Major
                Found in app/assets/javascripts/popup.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/popup.js on lines 1180..1183

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

                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

                        if (!IEConsole.block) {
                            IEConsole.block = IEConsole.createContainer();
                            document.body.insertBefore(IEConsole.block, document.body.childNodes[0]);
                            //IEConsole.inputElement.focus();
                        }
                Severity: Major
                Found in app/assets/javascripts/ie-console.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/ie-console.js on lines 45..49

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

                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

                        if (!IEConsole.block) {
                            IEConsole.block = IEConsole.createContainer();
                            document.body.insertBefore(IEConsole.block, document.body.childNodes[0]);
                            //IEConsole.inputElement.focus();
                        }
                Severity: Major
                Found in app/assets/javascripts/ie-console.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/ie-console.js on lines 261..265

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

                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 show has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Popup.prototype.show = function(options, modal) {
                    this.modal = this.modal || (typeof(modal)=="boolean" && modal);
                    if (defined(options) && options!=null && typeof(options)=="object") {
                        for (var i in options) {
                            this[i] = options[i];
                Severity: Minor
                Found in app/assets/javascripts/popup.js - About 1 hr to fix

                  Function setDateFromInput has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          o.setDateFromInput = function() {
                                  function m2c(val) {
                                          return String(val).length < 2 ? "00".substring(0, 2 - String(val).length) + String(val) : val;
                                  };
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

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

                    function totalMisspellings() {
                        var total_words = 0;
                        for( var i = 0; i < this.textInputs.length; i++ ) {
                            total_words += this.totalWords( i );
                        }
                    Severity: Major
                    Found in public/speller/wordWindow.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/spellerpages/wordWindow.js on lines 52..58

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

                    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 totalMisspellings() {
                        var total_words = 0;
                        for( var i = 0; i < this.textInputs.length; i++ ) {
                            total_words += this.totalWords( i );
                        }
                    Severity: Major
                    Found in app/assets/javascripts/spellerpages/wordWindow.js and 1 other location - About 1 hr to fix
                    public/speller/wordWindow.js on lines 52..58

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

                    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 spellChecker has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function spellChecker( textObject ) {
                    
                        // public properties - configurable
                        this.popUpUrl = '/speller/spellchecker.html';
                        this.popUpName = 'spellchecker';
                    Severity: Minor
                    Found in app/assets/javascripts/spellerpages/spellChecker.js - About 1 hr to fix

                      Function spellChecker has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function spellChecker( textObject ) {
                      
                          // public properties - configurable
                          this.popUpUrl = '/speller/spellchecker.html';
                          this.popUpName = 'spellchecker';
                      Severity: Minor
                      Found in public/speller/spellChecker.js - About 1 hr to fix

                        Function map has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function map(func) {
                            var i,j,o;
                            var results = [];
                            if (typeof(func)=="string") {
                                func = new Function('$_',func);
                        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

                        Severity
                        Category
                        Status
                        Source
                        Language