vegantech/sims

View on GitHub

Showing 433 of 433 total issues

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

    Method status has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def status
        if draft?
          STATUS[:draft]
        elsif promoted? and RECOMMENDATION[recommendation][:show_elig]
          STATUS[:can_refer]
    Severity: Minor
    Found in app/models/recommendation.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 a Cognitive Complexity of 15 (exceeds 5 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

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

    function ignoreAll() {
        var wi = this.currentWordIndex;
        var ti = this.currentTextIndex;
        if( !this.wordWin ) {
            alert( 'Error: Word frame not available.' );
    Severity: Minor
    Found in app/assets/javascripts/spellerpages/spellChecker.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 replaceAll has a Cognitive Complexity of 15 (exceeds 5 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

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

    function ignoreAll() {
        var wi = this.currentWordIndex;
        var ti = this.currentTextIndex;
        if( !this.wordWin ) {
            alert( 'Error: Word frame not available.' );
    Severity: Minor
    Found in public/speller/spellChecker.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

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

    function addSuggestion( sugg_text ) {
        var slct = this.suggestionList;
        if( sugg_text ) {
            var i = slct.options.length;
            var newOption = new Option( sugg_text, 'sugg_text'+i );
    Severity: Major
    Found in app/assets/javascripts/spellerpages/controlWindow.js and 1 other location - About 1 hr to fix
    public/speller/controlWindow.js on lines 54..61

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

    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 addSuggestion( sugg_text ) {
        var slct = this.suggestionList;
        if( sugg_text ) {
            var i = slct.options.length;
            var newOption = new Option( sugg_text, 'sugg_text'+i );
    Severity: Major
    Found in public/speller/controlWindow.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/spellerpages/controlWindow.js on lines 54..61

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

    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

                    createThAndButton(tr, [{className:"prev-but", id:"-prev-year-but", text:"\u00AB", title:datePicker.titles[2], onmousedown:function(e) { o.events.incDec(e,0,-1,0); }, onmouseout:o.events.clearTimer },{className:"prev-but", id:"-prev-month-but", text:"\u2039", title:datePicker.titles[0], onmousedown:function(e) { o.events.incDec(e,0,0,-1); }, onmouseout:o.events.clearTimer },{colspan:3, className:"today-but", id:"-today-but", text:datePicker.titles.length > 4 ? datePicker.titles[4] : "Today", onclick:o.events.gotoToday},{className:"next-but", id:"-next-month-but", text:"\u203A", title:datePicker.titles[1], onmousedown:function(e) { o.events.incDec(e,0,0,1); }, onmouseout:o.events.clearTimer },{className:"next-but", id:"-next-year-but", text:"\u00BB", title:datePicker.titles[3], onmousedown:function(e) { o.events.incDec(e,0,1,0); }, onmouseout:o.events.clearTimer }]);
    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 709..709

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

    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 resetForm() {
        if( this._forms ) {
            for( var i = 0; i < this._forms.length; i++ ) {
                this._forms[i].reset();
            }
    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 43..50

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

    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 resetForm() {
        if( this._forms ) {
            for( var i = 0; i < this._forms.length; i++ ) {
                this._forms[i].reset();
            }
    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 43..50

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

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

    window.onload = function(evt) {
        if (ieConsoleSavedOnLoad) ieConsoleSavedOnLoad(evt);
        if (typeof console == "undefined") console = {};
        if (typeof console.log == "undefined") {
            console.log = function(msg) {
    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

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

    function _getWordObject( textIndex, wordIndex ) {
        if( this._forms[textIndex] ) {
            if( this._forms[textIndex].elements[wordIndex] ) {
                return this._forms[textIndex].elements[wordIndex];
            }
    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 250..257

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

    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 _getWordObject( textIndex, wordIndex ) {
        if( this._forms[textIndex] ) {
            if( this._forms[textIndex].elements[wordIndex] ) {
                return this._forms[textIndex].elements[wordIndex];
            }
    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 250..257

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

    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(!range[0] || Number(sel.options[i].value) < range[0]) { range[0] = Number(sel.options[i].value); };
    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 1313..1313

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

    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(!range[1] || Number(sel.options[i].value) > range[1]) { range[1] = Number(sel.options[i].value); };
    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 1312..1312

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

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

            o.createButton = function() {
                    if(o.staticPos) { return; };
                    
                    var but;
                    
    Severity: Minor
    Found in app/assets/javascripts/datepicker.js - About 1 hr to fix

      Function setPosition has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Popup.prototype.setPosition = function() {
          if (this.position!=null) {
              var m = this.position.match(/^(\S+)\s+(\S+)/); 
              if (m!=null && m.length==3) {
                  var v = m[1];
      Severity: Minor
      Found in app/assets/javascripts/popup.js - About 1 hr to fix

        Function resolve has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            dom.resolve = function() {
                var results = new Array();
                var i,j,o;
                for (var i=0; i<arguments.length; i++) {
                    var o = arguments[i];
        Severity: Minor
        Found in app/assets/javascripts/popup.js - About 1 hr to fix

          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

          Severity
          Category
          Status
          Source
          Language