concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

File search.rb has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Search
  attr_accessor :engine
  attr_accessor :results
  attr_accessor :hits
  attr_accessor :total_entries
Severity: Minor
Found in rails/app/models/search.rb - About 3 hrs to fix

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

      @@all_table_pairs = [
        ['assessment_target_unifying_themes',      'ri_gse_assessment_target_unifying_themes'          ],
        ['biologica_multiple_organisms',           'embeddable_biologica_multiple_organisms'           ],
        ['biologica_breed_offsprings',             'embeddable_biologica_breed_offsprings'             ],
        ['smartgraph_range_questions',             'embeddable_smartgraph_range_questions'             ],
    Severity: Major
    Found in rails/db/migrate/20100121032411_embeddable_refactoring.rb and 1 other location - About 3 hrs to fix
    rails/db/migrate/20100121032411_embeddable_refactoring.rb on lines 43..83

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

    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

      @@all_model_classname_pairs = [
        ['AssessmentTargetUnifyingTheme',          'RiGse::AssessmentTargetUnifyingTheme'              ],
        ['BiologicaMultipleOrganism',              'Embeddable::Biologica::MultipleOrganism'           ],
        ['BiologicaBreedOffspring',                'Embeddable::Biologica::BreedOffspring'             ],
        ['Smartgraph::RangeQuestion',              'Embeddable::Smartgraph::RangeQuestion'             ],
    Severity: Major
    Found in rails/db/migrate/20100121032411_embeddable_refactoring.rb and 1 other location - About 3 hrs to fix
    rails/db/migrate/20100121032411_embeddable_refactoring.rb on lines 2..42

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

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

    PIE.Length = (function() {
        var lengthCalcEl = doc.createElement( 'length-calc' ),
            parent = doc.body || doc.documentElement,
            s = lengthCalcEl.style,
            conversions = {},
    Severity: Major
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 3 hrs to fix

      Function register_observers has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Chosen.prototype.register_observers = function() {
            var _this = this;
            this.container.observe("touchstart", function(evt) {
              _this.container_mousedown(evt);
              return evt.preventDefault();
      Severity: Major
      Found in rails/app/assets/javascripts/chosen.proto.js - About 3 hrs to fix

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

          getSize: function(innerSize) {
            if (innerSize)
              return { width:  this.options.width  - this.borderSize.width,
                       height: this.options.height - this.borderSize.height };
            else
        Severity: Major
        Found in rails/public/javascripts/light_box.js and 2 other locations - About 3 hrs to fix
        rails/app/assets/javascripts/livepipe/window.js on lines 1883..1889
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3640..3646

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

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

          getSize: function(innerSize) {
            if (innerSize)
              return { width:  this.options.width  - this.borderSize.width,
                       height: this.options.height - this.borderSize.height };
            else
        Severity: Major
        Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 3 hrs to fix
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3640..3646
        rails/public/javascripts/light_box.js on lines 3640..3646

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

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

          getSize: function(innerSize) {
            if (innerSize)
              return { width:  this.options.width  - this.borderSize.width,
                       height: this.options.height - this.borderSize.height };
            else
        Severity: Major
        Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 3 hrs to fix
        rails/app/assets/javascripts/livepipe/window.js on lines 1883..1889
        rails/public/javascripts/light_box.js on lines 3640..3646

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

        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

        Consider simplifying this complex logical expression.
        Open

                if (!options.HtmlText && this.textEnabled) {
                    var style = {
                        size: options.fontSize,
                        adjustAlign: true
                    };
        Severity: Critical
        Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 3 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                  if (!options.HtmlText && this.textEnabled) {
                      var style = {
                          size: options.fontSize,
                          adjustAlign: true
                      };
          Severity: Critical
          Found in rails/app/assets/javascripts/flotr/flotr.js - About 3 hrs to fix

            Class Search has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Search
              attr_accessor :engine
              attr_accessor :results
              attr_accessor :hits
              attr_accessor :total_entries
            Severity: Minor
            Found in rails/app/models/search.rb - About 3 hrs to fix

              Class ApplicationPolicy has 28 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ApplicationPolicy
                attr_reader :user, :original_user, :request, :params, :record
              
                def initialize(context, record)
                  if context.nil? || (context.is_a? User)
              Severity: Minor
              Found in rails/app/policies/application_policy.rb - About 3 hrs to fix

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

                    notify: function(eventName, resizable, event) {  // 'onStart', 'onEnd', 'onResize'
                        if(this[eventName+'Count'] > 0)
                            this.observers.each( function(o) {
                                if(o[eventName]) o[eventName](eventName, resizable, event);
                            });
                Severity: Major
                Found in rails/app/assets/javascripts/livepipe/resizable.js and 1 other location - About 3 hrs to fix
                rails/app/assets/javascripts/dragdrop.js on lines 207..213

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

                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

                  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
                    if(this[eventName+'Count'] > 0)
                      this.observers.each( function(o) {
                        if(o[eventName]) o[eventName](eventName, draggable, event);
                      });
                Severity: Major
                Found in rails/app/assets/javascripts/dragdrop.js and 1 other location - About 3 hrs to fix
                rails/app/assets/javascripts/livepipe/resizable.js on lines 79..85

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

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

                    draw: function() {
                        var me = this,
                            el = this.targetElement,
                            box = this.getBox(),
                            styleInfos = this.styleInfos,
                Severity: Major
                Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 3 hrs to fix

                  Function plotLineArea has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      plotLineArea: function(series, offset){
                          var data = series.data;
                          if(data.length < 2) return;
                  
                          var top, lastX = 0,
                  Severity: Major
                  Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 3 hrs to fix

                    Function plotLineArea has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        plotLineArea: function(series, offset){
                            var data = series.data;
                            if(data.length < 2) return;
                    
                            var top, lastX = 0,
                    Severity: Major
                    Found in rails/app/assets/javascripts/flotr/flotr.js - About 3 hrs to fix

                      Method import_model_library has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def import_model_library
                          authorize Interactive
                          if request.post?
                            respond_to do |format|
                              begin
                      Severity: Minor
                      Found in rails/app/controllers/interactives_controller.rb - About 3 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 update has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def update
                          # PUNDIT_REVIEW_AUTHORIZE
                          # PUNDIT_CHECK_AUTHORIZE (did not find instance)
                          # authorize @clazz
                          @portal_clazz = Portal::Clazz.find(params[:id])
                      Severity: Minor
                      Found in rails/app/controllers/portal/clazzes_controller.rb - About 3 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

                      WindowManager has 27 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      UI.WindowManager = Class.create(UI.Options, {
                        options: {
                          container:   null, // will default to document.body
                          zIndex:      0,
                          theme:       "alphacube",
                      Severity: Minor
                      Found in rails/public/javascripts/light_box.js - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language