concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

  setPosition: function(top, left) {
    var pos = this.computePosition(top, left);
    this.options.top  = pos.top;
    this.options.left = pos.left;

Severity: Major
Found in rails/public/javascripts/light_box.js and 2 other locations - About 5 hrs to fix
rails/app/assets/javascripts/livepipe/window.js on lines 1832..1843
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3589..3600

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

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

    def links_for_material( material,
                            skip_lightbox_reloads = false )
      external = false
      if material.is_a? ExternalActivity
        browse_url = browse_external_activity_url(material)
Severity: Major
Found in rails/lib/materials/data_helpers.rb - About 4 hrs to fix

    Method path_to has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def path_to(page_name)
        case page_name
        when /the root path/
          "/"
        when /the home\s?page/
    Severity: Major
    Found in rails/features/support/paths.rb - About 4 hrs to fix

      Method search has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

        def search
          self.results[:all] = []
          self.hits[:all] = []
          self.total_entries[:all] = 0
      
      
      Severity: Minor
      Found in rails/app/models/search.rb - About 4 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

            if ( whichSide == "left" ) {
               el.style.marginLeft = marginSize + "px"; el.style.marginRight = "0px";
            }
            else if ( whichSide == "right" ) {
               el.style.marginRight = marginSize + "px"; el.style.marginLeft  = "0px";
      rails/app/assets/javascripts/active_scaffold/default/rico_corner.js on lines 311..319

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

      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 ( whichSide == "left" ) {
               el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = "0px";
            }
            else if ( whichSide == "right" ) {
               el.style.borderRightWidth = borderSize + "px"; el.style.borderLeftWidth  = "0px";
      rails/app/assets/javascripts/active_scaffold/default/rico_corner.js on lines 297..305

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

      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 Clazz has 37 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Portal::Clazz < ApplicationRecord
        self.table_name = :portal_clazzes
      
        acts_as_replicatable
      
      
      Severity: Minor
      Found in rails/app/models/portal/clazz.rb - About 4 hrs to fix

        File stem-finder-result.tsx has 365 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from "react";
        import Component from "../helpers/component";
        import { MakeTeacherEditionLink } from "../helpers/make-teacher-edition-links";
        import GradeLevels from "./grade-levels";
        import StemFinderResultStandards from "./stem-finder-result-standards";
        Severity: Minor
        Found in rails/react-components/src/library/components/stem-finder-result.tsx - About 4 hrs to fix

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

            setResizable: function(resizable) {
              this.options.resizable = resizable;
          
              var toggleClassName = (resizable ? 'add' : 'remove') + 'ClassName';
          
          
          Severity: Major
          Found in rails/app/assets/javascripts/livepipe/window.js and 1 other location - About 4 hrs to fix
          rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3751..3764

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

          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

            setResizable: function(resizable) {
              this.options.resizable = resizable;
          
              var toggleClassName = (resizable ? 'add' : 'remove') + 'ClassName';
          
          
          Severity: Major
          Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 4 hrs to fix
          rails/app/assets/javascripts/livepipe/window.js on lines 1994..2007

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

          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

            constructor (props: any) {
              super(props);
              this.state = {
                canSubmit: false
              };
          rails/react-components/src/library/components/materials-bin/material.tsx on lines 4..13

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

          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

            constructor (props: any) {
              super(props);
              this.state = {
                descriptionVisible: false,
              };
          rails/react-components/src/library/components/signup/basic_data_form.tsx on lines 17..27

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

          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

          function condense( unmatched, map, filter, context, xml ) {
              var elem,
                  newUnmatched = [],
                  i = 0,
                  len = unmatched.length,
          Severity: Major
          Found in rails/app/assets/javascripts/jquery/jquery.js and 1 other location - About 4 hrs to fix
          rails/app/assets/javascripts/prototype.js on lines 5884..5903

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

          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

            function condense( unmatched, map, filter, context, xml ) {
              var elem,
                newUnmatched = [],
                i = 0,
                len = unmatched.length,
          Severity: Major
          Found in rails/app/assets/javascripts/prototype.js and 1 other location - About 4 hrs to fix
          rails/app/assets/javascripts/jquery/jquery.js on lines 4810..4829

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

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

            render () {
              const { currentTeachers } = this.state;
              const { portalClass, portalClassTeacher, schools, portalClassGrades, enableGradeLevels, activeGrades, cancelLink, errors, teachers } = this.props;
              const creating = !portalClass.id;
              const updating = !creating;

            Method create has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                # PUNDIT_REVIEW_AUTHORIZE
                # PUNDIT_CHECK_AUTHORIZE
                # authorize Portal::Clazz
            
            
            Severity: Minor
            Found in rails/app/controllers/portal/clazzes_controller.rb - About 4 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

            PortalComponents has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            window.PortalPages = window.PortalComponents = {
              settings: {}, // default to empty, used to set flags from portal templates
            
              // The URL of the page will change as the user opens resource lightboxes. This
              // initialPath provides a way for the code to know the initial page loaded was
            Severity: Minor
            Found in rails/react-components/src/library/library.tsx - About 4 hrs to fix

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

              Object.extend(String.prototype, {
                camelcase: function() {
                  var string = this.dasherize().camelize();
                  return string.charAt(0).toUpperCase() + string.slice(1);
                },
              Severity: Major
              Found in rails/public/javascripts/light_box.js and 2 other locations - About 4 hrs to fix
              rails/app/assets/javascripts/livepipe/window.js on lines 130..153
              rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 134..157

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

              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

              Object.extend(String.prototype, {
                camelcase: function() {
                  var string = this.dasherize().camelize();
                  return string.charAt(0).toUpperCase() + string.slice(1);
                },
              Severity: Major
              Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 4 hrs to fix
              rails/app/assets/javascripts/livepipe/window.js on lines 130..153
              rails/public/javascripts/light_box.js on lines 134..157

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

              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

              Object.extend(String.prototype, {
                camelcase: function() {
                  var string = this.dasherize().camelize();
                  return string.charAt(0).toUpperCase() + string.slice(1);
                },
              Severity: Major
              Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 4 hrs to fix
              rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 134..157
              rails/public/javascripts/light_box.js on lines 134..157

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

              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