concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

  startModalSession: function(win) {
    if (!this.modalSessions) {
      this.removeOverflow();
      this.modalOverlay.className = win.getTheme() + "_overlay";
      this.container.appendChild(this.modalOverlay);
Severity: Major
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 1 day to fix
rails/public/javascripts/light_box.js on lines 4684..4702

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

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

File excanvas.js has 721 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Major
Found in rails/app/assets/javascripts/flotr/excanvas.js - About 1 day to fix

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

    import React from "react";
    
    import StemFinderResult from "./stem-finder-result";
    import sortByName from "../helpers/sort-by-name";
    import sortResources from "../helpers/sort-resources";
    Severity: Major
    Found in rails/react-components/src/library/components/stem-finder.tsx - About 1 day to fix

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

      Element.addMethods({
        getScrollDimensions: function(element) {
          element = $(element);
          return {
            width:  element.scrollWidth,
      Severity: Major
      Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 1 day to fix
      rails/public/javascripts/light_box.js on lines 226..263

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

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

      Element.addMethods({
        getScrollDimensions: function(element) {
          element = $(element);
          return {
            width:  element.scrollWidth,
      Severity: Major
      Found in rails/public/javascripts/light_box.js and 1 other location - About 1 day to fix
      rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 226..263

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

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

        def self.create_default_users
          puts
          puts
          admin_info = DEFAULT_DATA[:admin_settings]
          settings = Admin::Settings.find_by_uuid(admin_info[:uuid])
      Severity: Minor
      Found in rails/lib/mock_data/create_default_data.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

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

        initialize: function(options) {
          this.setOptions(options);
      
          this.container = $(this.options.container || document.body);
      
      
      Severity: Major
      Found in rails/app/assets/javascripts/livepipe/window.js and 1 other location - About 1 day to fix
      rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4569..4592

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

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

        initialize: function(options) {
          this.setOptions(options);
      
          this.container = $(this.options.container || document.body);
      
      
      Severity: Major
      Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 1 day to fix
      rails/app/assets/javascripts/livepipe/window.js on lines 2609..2632

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

      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

      File 20090701153613_create_nces06_tables.rb has 680 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class CreateNces06Tables < ActiveRecord::Migration[5.1]
      
        def self.up
          create_table :portal_nces06_districts do |t|
            t.string  :LEAID,     :limit => 7       # NCES Local Education Agency ID.  The first two positions of this field are also the Federal Information Profesing Standards (FIPS) state code.
      Severity: Major
      Found in rails/db/migrate/20090701153613_create_nces06_tables.rb - About 1 day to fix

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

        UI.URLWindow = Class.create(UI.Window, {
          options: {
            url: 'about:blank'
          },
        
        
        Severity: Major
        Found in rails/public/javascripts/light_box.js and 1 other location - About 1 day to fix
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3992..4031

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

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

        UI.URLWindow = Class.create(UI.Window, {
          options: {
            url: 'about:blank'
          },
        
        
        Severity: Major
        Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 1 day to fix
        rails/public/javascripts/light_box.js on lines 3992..4031

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          center: function(options) {
            var size          = this.getSize(),
                windowManager = this.windowManager,
                viewport      = windowManager.viewport;
                viewportArea  = viewport.getDimensions(),
        Severity: Major
        Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 1 day to fix
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3609..3628
        rails/public/javascripts/light_box.js on lines 3609..3628

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          center: function(options) {
            var size          = this.getSize(),
                windowManager = this.windowManager,
                viewport      = windowManager.viewport;
                viewportArea  = viewport.getDimensions(),
        Severity: Major
        Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 1 day to fix
        rails/app/assets/javascripts/livepipe/window.js on lines 1852..1871
        rails/public/javascripts/light_box.js on lines 3609..3628

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          center: function(options) {
            var size          = this.getSize(),
                windowManager = this.windowManager,
                viewport      = windowManager.viewport;
                viewportArea  = viewport.getDimensions(),
        Severity: Major
        Found in rails/public/javascripts/light_box.js and 2 other locations - About 1 day to fix
        rails/app/assets/javascripts/livepipe/window.js on lines 1852..1871
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3609..3628

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

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

          def self.create_default_users
            puts
            puts
            admin_info = DEFAULT_DATA[:admin_settings]
            settings = Admin::Settings.find_by_uuid(admin_info[:uuid])
        Severity: Major
        Found in rails/lib/mock_data/create_default_data.rb - About 1 day to fix

          Function Element has 286 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Element( el ) {
                  var renderers,
                      rootRenderer,
                      boundsInfo = new PIE.BoundsInfo( el ),
                      styleInfos,
          Severity: Major
          Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 day to fix

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

                const clicked = () => {
                  this.setState((prev) => {
                    const gradeLevelsSelected = prev.gradeLevelsSelected.slice();
                    const gradeLevelsSelectedMap = prev.gradeLevelsSelectedMap;
                    const index = gradeLevelsSelected.indexOf(gradeLevel);
            rails/react-components/src/library/components/stem-finder.tsx on lines 416..443

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

            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 clicked = () => {
                  this.setState((prev) => {
                    const subjectAreasSelected = prev.subjectAreasSelected.slice();
                    const subjectAreasSelectedMap = prev.subjectAreasSelectedMap;
                    const index = subjectAreasSelected.indexOf(subjectArea);
            rails/react-components/src/library/components/stem-finder.tsx on lines 461..488

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

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

            class User < ApplicationRecord
              has_many :authentications, :dependent => :delete_all
              has_many :access_grants, :dependent => :delete_all
            
              has_many :favorites
            Severity: Major
            Found in rails/app/models/user.rb - About 1 day to fix

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

              function preview_about_page(aboutPageContentId, aboutPageContent){
                  var previewContent = null;
              
                  if(aboutPageContentId){
                      previewContent = $(aboutPageContentId).value;
              Severity: Major
              Found in rails/app/assets/javascripts/preview_about_page.js and 1 other location - About 1 day to fix
              rails/app/assets/javascripts/preview_home_page.js on lines 1..46

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

              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