concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Method perform has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    import = Import::Import.find(import_id)
    content_hash = JSON.parse(import.upload_data, :symbolize_names => true)
    total_districts_count = content_hash[:districts].size
    total_schools_count = content_hash[:schools].size
Severity: Minor
Found in rails/app/models/import/import_schools_and_districts.rb - About 1 day 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 setDocument has 215 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  setDocument = Sizzle.setDocument = function( node ) {
    var hasCompare,
      doc = node ? node.ownerDocument || node : preferredDoc,
      parent = doc.defaultView;

Severity: Major
Found in rails/app/assets/javascripts/prototype.js - About 1 day to fix

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

        const unhelpedStandards = unhelped.map(function (statement, idx) {
          let description = statement.description;
          if (Array.isArray(description)) {
            let formatted = "";
            for (let i = 0; i < description.length; i++) {
    rails/react-components/src/library/components/resource-lightbox.tsx on lines 257..277

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

    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

        const unhelpedStandards = unhelped.map(function (statement, idx) {
          let description = statement.description;
          if (Array.isArray(description)) {
            let formatted = "";
            for (let i = 0; i < description.length; i++) {
    rails/react-components/src/library/components/stem-finder-result-standards.tsx on lines 29..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 207.

    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

    Method materials_data has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def materials_data( materials,
                            assigned_to_class       = nil,
                            include_related         = 0,
                            skip_lightbox_reloads   = false )
          data = []
    Severity: Major
    Found in rails/lib/materials/data_helpers.rb - About 1 day to fix

      Graph has 59 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Flotr.Graph = Class.create({
          /**
           * Flotr Graph constructor.
           * @param {Element} el - element to insert the graph into
           * @param {Object} data - an array or object of dataseries
      Severity: Major
      Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 day to fix

        Graph has 59 functions (exceeds 20 allowed). Consider refactoring.
        Open

        Flotr.Graph = Class.create({
            /**
             * Flotr Graph constructor.
             * @param {Element} el - element to insert the graph into
             * @param {Object} data - an array or object of dataseries
        Severity: Major
        Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 day to fix

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

          Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
            if (!options) return;
            function fallback(name, expr) {
              if (name in options || expr === undefined) return;
              options[name] = expr;
          Severity: Major
          Found in rails/app/assets/javascripts/controls.js and 1 other location - About 1 day to fix
          rails/app/assets/javascripts/in_place_rich_editor/patch_inplaceeditor_editonblank_1-8-1.js on lines 58..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 204.

          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

          Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
            if (!options) return;
            function fallback(name, expr) {
              if (name in options || expr === undefined) return;
              options[name] = expr;
          rails/app/assets/javascripts/controls.js on lines 857..869

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

          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

          Method perform has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
          Open

            def perform
              import = Import::Import.find(import_id)
              content_hash = JSON.parse(import.upload_data, :symbolize_names => true)
              total_users_count = content_hash[:users].size
              batch_size = 250
          Severity: Minor
          Found in rails/app/models/import/import_users.rb - About 1 day 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 Enumerable has 206 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var Enumerable = (function() {
            function each(iterator, context) {
              try {
                this._each(iterator, context);
              } catch (e) {
          Severity: Major
          Found in rails/app/assets/javascripts/prototype.js - About 1 day to fix

            Function parseCss has 204 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                parseCss: function( css ) {
                    var el = this.targetElement,
                        cs = el.currentStyle,
                        tokenizer, token, image,
                        tok_type = PIE.Tokenizer.Type,
            Severity: Major
            Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 day to fix

              Function setOptions has 204 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  setOptions: function(opts){
                      var options = {
                          colors: ['#00A8F0', '#C0D800', '#CB4B4B', '#4DA74D', '#9440ED'], //=> The default colorscheme. When there are > 5 series, additional colors are generated.
                          title: null,
                          subtitle: null,
              Severity: Major
              Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 day to fix

                Function setOptions has 204 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    setOptions: function(opts){
                        var options = {
                            colors: ['#00A8F0', '#C0D800', '#CB4B4B', '#4DA74D', '#9440ED'], //=> The default colorscheme. When there are > 5 series, additional colors are generated.
                            title: null,
                            subtitle: null,
                Severity: Major
                Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 day to fix

                  Function extendXRangeIfNeededByBar has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                  Open

                      extendXRangeIfNeededByBar: function(axis){
                          if(axis.options.max == null){
                              var newmin = axis.min,
                                  newmax = axis.max,
                                  i, s, b, c,
                  Severity: Minor
                  Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 day 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 extendXRangeIfNeededByBar has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                  Open

                      extendXRangeIfNeededByBar: function(axis){
                          if(axis.options.max == null){
                              var newmin = axis.min,
                                  newmax = axis.max,
                                  i, s, b, c,
                  Severity: Minor
                  Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 day 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 query_es has 200 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.query_es(options, user)
                      if user.has_role?('manager','admin','researcher')
                        all_access = true
                      else
                        all_access = false
                  Severity: Major
                  Found in rails/app/controllers/api/v1/report_learners_es_controller.rb - About 1 day to fix

                    Method user_authorized_for? has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def user_authorized_for?(user, params = {}, binding = self.binding)
                          return true unless Array===self.role_requirements
                          self.role_requirements.each{| role_requirement|
                            roles = role_requirement[:roles]
                            options = role_requirement[:options]
                    Severity: Minor
                    Found in rails/lib/role_requirement_system.rb - About 7 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

                    File application_helper.rb has 485 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module ApplicationHelper
                      include Clipboard
                      include Pundit
                    
                      def current_settings
                    Severity: Minor
                    Found in rails/app/helpers/application_helper.rb - About 7 hrs to fix

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

                        hide: function() {
                          if (!this.visible) return this;
                      
                          this.fire('hiding');
                          this.effect('hide');
                      Severity: Major
                      Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 7 hrs to fix
                      rails/app/assets/javascripts/livepipe/window.js on lines 1513..1535
                      rails/public/javascripts/light_box.js on lines 3261..3283

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

                      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