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

  getWindow: function(element) {
    element = $(element);

    if (!element) return;

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 2689..2699
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4649..4659

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

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

       create: function(options) {
               
               /*
                       options - object to store initialization parameters
                       options.blankURL - string to override the default location of blank.html. Must end in "?"
Severity: Minor
Found in rails/app/assets/javascripts/active_scaffold/default/dhtml_history.js - 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 stem_resources has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def stem_resources

    # logger.info("INFO stem_resources")

    if ! params[:id]
Severity: Minor
Found in rails/app/controllers/home_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 _get_school_layout has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def _get_school_layout(layout_file)
    columns = []
    File.open(layout_file, "r:iso-8859-1") do |file|
      count = 0
      line = ''
Severity: Minor
Found in rails/lib/nces_parser.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 _get_district_layout has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def _get_district_layout(layout_file)
    columns = []
    File.open(layout_file, "r:iso-8859-1") do |file|
      count = 0
      line = ''
Severity: Minor
Found in rails/lib/nces_parser.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

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

export const ProjectEdit = props => (
  <Edit {...props}>
    <SimpleForm>
      <TextInput source="name" />
      <TextInput source="landingPageSlug" />
Severity: Major
Found in admin-panel/react-admin-interface/src/entities/project.js and 1 other location - About 3 hrs to fix
admin-panel/react-admin-interface/src/entities/project.js on lines 35..45

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

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

export const ProjectCreate = props => (
  <Create {...props}>
    <SimpleForm>
      <TextInput source="name" />
      <TextInput source="landingPageSlug" />
Severity: Major
Found in admin-panel/react-admin-interface/src/entities/project.js and 1 other location - About 3 hrs to fix
admin-panel/react-admin-interface/src/entities/project.js on lines 23..33

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

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

function defaultPrefilter( elem, props, opts ) {
    var index, prop, value, length, dataShow, tween, hooks, oldfire,
        anim = this,
        style = elem.style,
        orig = {},
Severity: Major
Found in rails/app/assets/javascripts/jquery/jquery.js - About 3 hrs to fix

    StemFinderResult has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const StemFinderResult = Component({
      getInitialState () {
        return {
          favorited: this.props.resource.is_favorite,
          hovering: false,
    Severity: Minor
    Found in rails/react-components/src/library/components/stem-finder-result.tsx - About 3 hrs to fix

      Function create has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        create: function(element) {
          element = $(element);
          var options = Object.extend({
            element:     element,
            tag:         'li',       // assumes li children, override with tag: 'tagname'
      Severity: Major
      Found in rails/app/assets/javascripts/dragdrop.js - About 3 hrs to fix

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

              if(dropon.previousSibling != element) {
                var oldParentNode = element.parentNode;
                element.style.visibility = "hidden"; // fix gecko rendering
                dropon.parentNode.insertBefore(element, dropon);
                if(dropon.parentNode!=oldParentNode)
        Severity: Major
        Found in rails/app/assets/javascripts/dragdrop.js and 1 other location - About 3 hrs to fix
        rails/app/assets/javascripts/dragdrop.js on lines 770..777

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

        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(nextElement != element) {
                var oldParentNode = element.parentNode;
                element.style.visibility = "hidden"; // fix gecko rendering
                dropon.parentNode.insertBefore(element, nextElement);
                if(dropon.parentNode!=oldParentNode)
        Severity: Major
        Found in rails/app/assets/javascripts/dragdrop.js and 1 other location - About 3 hrs to fix
        rails/app/assets/javascripts/dragdrop.js on lines 759..766

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

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

        PIE.Color = (function() {
            var instances = {};
        
            function Color( val ) {
                this.val = val;
        Severity: Major
        Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 3 hrs to fix

          Function clean has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              clean: function( elems, context, fragment, scripts ) {
                  var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
                      safe = context === document && safeFragment,
                      ret = [];
          
          
          Severity: Major
          Found in rails/app/assets/javascripts/jquery/jquery.js - About 3 hrs to fix

            Function render has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render () {
                const { anonymous } = this.props;
                const { canSubmit, currentCountry, currentZipcode, registerNewSchool } = this.state;
                const showZipcode = currentCountry != null;
                const showSchool = (currentCountry != null) && (currentZipcode != null);
            Severity: Major
            Found in rails/react-components/src/library/components/signup/teacher_form.tsx - About 3 hrs to fix

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

                resize: function(event) {
                  var area = this.viewport.getDimensions();
              
                  if (this.maximizedWindow)
                    this.maximizedWindow.setSize(area.width, area.height);
              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 2889..2897
              rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4856..4864

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

              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

                resize: function(event) {
                  var area = this.viewport.getDimensions();
              
                  if (this.maximizedWindow)
                    this.maximizedWindow.setSize(area.width, area.height);
              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 4856..4864
              rails/public/javascripts/light_box.js on lines 4856..4864

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

              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

                contextPrototype.moveTo = function(aX, aY) {
                  var p = this.getCoords_(aX, aY);
                  this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
                  this.currentX_ = p.x;
                  this.currentY_ = p.y;
              Severity: Major
              Found in rails/app/assets/javascripts/flotr/excanvas.js and 1 other location - About 3 hrs to fix
              rails/app/assets/javascripts/flotr/excanvas.js on lines 337..343

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

              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

                contextPrototype.lineTo = function(aX, aY) {
                  var p = this.getCoords_(aX, aY);
                  this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
              
                  this.currentX_ = p.x;
              Severity: Major
              Found in rails/app/assets/javascripts/flotr/excanvas.js and 1 other location - About 3 hrs to fix
              rails/app/assets/javascripts/flotr/excanvas.js on lines 330..335

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

              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

                resize: function(event) {
                  var area = this.viewport.getDimensions();
              
                  if (this.maximizedWindow)
                    this.maximizedWindow.setSize(area.width, area.height);
              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 2889..2897
              rails/public/javascripts/light_box.js on lines 4856..4864

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

              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