vegantech/sims

View on GitHub

Showing 433 of 433 total issues

Avoid too many return statements within this method.
Open

      redirect_to students_url and return false
Severity: Major
Found in app/controllers/students_controller.rb - About 30 mins to fix

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

            o.removeKeyboardEvents =function() {
                    datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
                    datePickerController.removeEvent(document, "keydown",  o.events.onkeydown);
            };
    Severity: Minor
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 30 mins to fix
    app/assets/javascripts/datepicker.js on lines 1087..1090

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

    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(window.devicePixelRatio) {
                            datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
                            datePickerController.addEvent(document, "keydown", o.events.onkeydown);
                    };
    Severity: Minor
    Found in app/assets/javascripts/datepicker.js and 1 other location - About 30 mins to fix
    app/assets/javascripts/datepicker.js on lines 1092..1095

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

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

      def create
        @goal_definition = current_district.goal_definitions.build(params[:goal_definition])
        respond_to do |format|
          if @goal_definition.save
            flash[:notice] = 'Goal was successfully created.'
    Severity: Minor
    Found in app/controllers/intervention_builder/goals_controller.rb and 2 other locations - About 30 mins to fix
    app/controllers/district/flag_categories_controller.rb on lines 29..37
    app/controllers/tiers_controller.rb on lines 31..39

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

    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

        respond_to do |format|
          if @answer_definition.save
            flash[:notice] = 'Answer Definition was successfully created.'
            format.html { redirect_to checklist_builder_answer_url(@checklist_definition, @question_definition, @element_definition, @answer_definition) }
            format.js
    Severity: Minor
    Found in app/controllers/checklist_builder/answers_controller.rb and 1 other location - About 30 mins to fix
    app/controllers/checklist_builder/answers_controller.rb on lines 57..64

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

    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

        respond_to do |format|
          if @answer_definition.save
            flash[:notice] = 'Answer Definition was successfully updated.'
            format.html { redirect_to checklist_builder_answer_url(@checklist_definition, @question_definition, @element_definition, @answer_definition) }
            format.js
    Severity: Minor
    Found in app/controllers/checklist_builder/answers_controller.rb and 1 other location - About 30 mins to fix
    app/controllers/checklist_builder/answers_controller.rb on lines 41..48

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

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

      def create
        @tier = current_district.tiers.build(params[:tier])
    
        respond_to do |format|
          if @tier.save
    Severity: Minor
    Found in app/controllers/tiers_controller.rb and 2 other locations - About 30 mins to fix
    app/controllers/district/flag_categories_controller.rb on lines 29..37
    app/controllers/intervention_builder/goals_controller.rb on lines 31..38

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

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

      def create
        @flag_category = current_district.flag_categories.build(params[:flag_category])
    
        respond_to do |format|
          if @flag_category.save
    Severity: Minor
    Found in app/controllers/district/flag_categories_controller.rb and 2 other locations - About 30 mins to fix
    app/controllers/intervention_builder/goals_controller.rb on lines 31..38
    app/controllers/tiers_controller.rb on lines 31..39

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

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

    function replaceWord() {
        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 25 mins 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 _getFormInputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function _getFormInputs( inputPattern ) {
        var inputs = new Array();
        for( var i = 0; i < document.forms.length; i++ ) {
            for( var j = 0; j < document.forms[i].elements.length; j++ ) {
                if( document.forms[i].elements[j].type.match( inputPattern )) {
    Severity: Minor
    Found in app/assets/javascripts/spellerpages/spellChecker.js - About 25 mins 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 mark_promoted_if_needed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def mark_promoted_if_needed
        if draft?
          self.promoted=false
          return true
        elsif errors.empty? and recommendation and should_promote?
    Severity: Minor
    Found in app/models/recommendation.rb - About 25 mins 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 _getTotalReplaced has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function _getTotalReplaced() {
        var i_replaced = 0;
        for( var i = 0; i < this.wordFlags.length; i++ ) {
            for( var j = 0; j < this.wordFlags[i].length; j++ ) {
                if(( this.wordFlags[i][j] == this.replWordFlag )
    Severity: Minor
    Found in public/speller/spellChecker.js - About 25 mins 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 _getTotalReplaced has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function _getTotalReplaced() {
        var i_replaced = 0;
        for( var i = 0; i < this.wordFlags.length; i++ ) {
            for( var j = 0; j < this.wordFlags[i].length; j++ ) {
                if(( this.wordFlags[i][j] == this.replWordFlag )
    Severity: Minor
    Found in app/assets/javascripts/spellerpages/spellChecker.js - About 25 mins 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 replaceWord has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function replaceWord() {
        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 25 mins 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 _getFormInputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function _getFormInputs( inputPattern ) {
        var inputs = new Array();
        for( var i = 0; i < document.forms.length; i++ ) {
            for( var j = 0; j < document.forms[i].elements.length; j++ ) {
                if( document.forms[i].elements[j].type.match( inputPattern )) {
    Severity: Minor
    Found in public/speller/spellChecker.js - About 25 mins 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 Popup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    var Popup = function(div, options) {
        this.div = defined(div)?div:null;
        this.index = Popup.maxIndex++;
        this.ref = "Popup.objects["+this.index+"]";
        Popup.objects[this.index] = this;
    Severity: Minor
    Found in app/assets/javascripts/popup.js - About 25 mins 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 intervention_probe_assignment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def intervention_probe_assignment(probe_definition_id = nil)
        if probe_definition_id
          intervention_probe_assignments.find_or_initialize_by_probe_definition_id(probe_definition_id)
        else
          p=@ipa || intervention_probe_assignments.active.first
    Severity: Minor
    Found in app/models/intervention.rb - About 25 mins 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 createPromptAndInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        createPromptAndInput: function() {
            var container = document.createElement("div");
            container.innerHTML = "<table style=\"width: 100%\" cellspacing=\"0\" cellpadding=\"0\"><tr>" +
                "<td width=\"25\" style=\"padding-top: 10px;\">&gt;&gt;&gt;</td>" +
                "<td><input type=\"text\" /></td>" +
    Severity: Minor
    Found in app/assets/javascripts/ie-console.js - About 25 mins 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 answers= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def answers=(hsh={})
        hsh.each do |h|
          h=h.last if h.is_a?Array and h.size==2
          h=h.symbolize_keys
          if h[:recommendation_answer_definition_id]
    Severity: Minor
    Found in app/models/recommendation.rb - About 25 mins 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 setDefaultValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function setDefaultValues(o,values) {
        if (!defined(o) || o==null) {
            o = {};
        }
        if (!defined(values) || values==null) {
    Severity: Minor
    Found in app/assets/javascripts/popup.js - About 25 mins 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