vegantech/sims

View on GitHub

Showing 433 of 433 total issues

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

                        if(o.splitDate) {
                                var mmN = document.getElementById(o.id+'-mm');
                                var ddN = document.getElementById(o.id+'-dd');
                                datePickerController.addEvent(mmN, "change", o.changeHandler);
                                datePickerController.addEvent(ddN, "change", o.changeHandler);
Severity: Major
Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/datepicker.js on lines 1151..1157

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

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

    ev.getMouseY = function(e) {
        e = ev.resolve(e);
        if (defined(e.pageY)) {
            return e.pageY;
        }
Severity: Major
Found in app/assets/javascripts/popup.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/popup.js on lines 389..398

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

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

    ev.getMouseX = function(e) {
        e = ev.resolve(e);
        if (defined(e.pageX)) {
            return e.pageX;
        }
Severity: Major
Found in app/assets/javascripts/popup.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/popup.js on lines 399..408

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

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

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

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

            o.setRangeHigh = function(range) {
                    if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = '';
                    o.high = o.defaults.high = range;
                    if(o.staticPos) o.updateTable(true);
            };
    Severity: Major
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/datepicker.js on lines 340..344

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

    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

            o.setRangeLow = function(range) {
                    if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = '';
                    o.low = o.defaults.low = range;
                    if(o.staticPos) o.updateTable(true);
            };
    Severity: Major
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/datepicker.js on lines 345..349

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

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

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

        function _adjustIndexes( textIndex, wordIndex, lengthDiff ) {
            for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) {
                this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff;
            }
        }
        Severity: Major
        Found in public/speller/wordWindow.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/spellerpages/wordWindow.js on lines 265..269

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

        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 _adjustIndexes( textIndex, wordIndex, lengthDiff ) {
            for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) {
                this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff;
            }
        }
        Severity: Major
        Found in app/assets/javascripts/spellerpages/wordWindow.js and 1 other location - About 2 hrs to fix
        public/speller/wordWindow.js on lines 265..269

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

        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

        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

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

              ev.preventDefault = function(e) {
                  e = ev.resolve(e);
                  if (typeof(e.preventDefault)=="function") { e.preventDefault(); } 
                  if (defined(e.returnValue)) { e.returnValue = false; }
              };
          Severity: Major
          Found in app/assets/javascripts/popup.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/popup.js on lines 413..417

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

          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

              ev.cancelBubble = function(e) {
                  e = ev.resolve(e);
                  if (typeof(e.stopPropagation)=="function") { e.stopPropagation(); } 
                  if (defined(e.cancelBubble)) { e.cancelBubble = true; }
              };
          Severity: Major
          Found in app/assets/javascripts/popup.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/popup.js on lines 422..426

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

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

            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

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

                    o.realOffset = function(element) {
                            var t = 0, l = 0;
                            do {
                                    t += element.scrollTop  || 0;
                                    l += element.scrollLeft || 0;
            Severity: Major
            Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/datepicker.js on lines 455..463

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

            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

                    o.cumulativeOffset = function(element) {
                            var t = 0, l = 0;
                            do {
                                    t += element.offsetTop  || 0;
                                    l += element.offsetLeft || 0;
            Severity: Major
            Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/datepicker.js on lines 446..454

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

            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 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 public/speller/controlWindow.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/spellerpages/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/datepicker.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/tablesort.js on lines 61..68

            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

            Severity
            Category
            Status
            Source
            Language