concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

    for (const filter of ["teachers", "cohorts", "runnables"]) {
      if ((this.state[filter] != null ? this.state[filter].length : undefined) > 0) {
        params[filter] = this.state[filter].map((v: any) => v.value).sort().join(",");
      }
    }
rails/react-components/src/library/components/user-report-form/index.tsx on lines 117..121

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

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

    for (const filter of ["teachers", "cohorts", "runnables"]) {
      if ((this.state[filter] != null ? this.state[filter].length : undefined) > 0) {
        params[filter] = this.state[filter].map((v: any) => v.value).sort().join(",");
      }
    }
rails/react-components/src/library/components/researcher-classes-form/index.tsx on lines 107..111

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

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

    drawTitles: function(){
        var html,
            options = this.options,
            margin = options.grid.labelMargin,
            ctx = this.ctx,
Severity: Major
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 3 hrs to fix

    Function drawTitles has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        drawTitles: function(){
            var html,
                options = this.options,
                margin = options.grid.labelMargin,
                ctx = this.ctx,
    Severity: Major
    Found in rails/app/assets/javascripts/flotr/flotr.js - About 3 hrs to fix

      Class SchoolSelector has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Portal::SchoolSelector
        USA = "United States"
        NO_STATE = "XX"  # db field width is 2 chars. :
        CHOICES_FILE = File.join(Rails.root, "resources", "country_list.txt")
        @@country_choices = nil
      Severity: Minor
      Found in rails/app/models/portal/school_selector.rb - About 3 hrs to fix

        File index.tsx has 326 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from "react";
        import Select from "react-select";
        import { debounce } from "throttle-debounce";
        import jQuery from "jquery";
        import ExternalReportButton from "../common/external-report-button";

          Function draw has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              draw: function() {
                  var me = this,
                      props = me.styleInfos.borderImageInfo.getProps(),
                      borderProps = me.styleInfos.borderInfo.getProps(),
                      bounds = me.boundsInfo.getBounds(),
          Severity: Major
          Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 3 hrs to fix

            Function displayCompletion has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

              displayCompletion: function(event) {
                var value = this.input.value.strip();
                this.current = null;
                if (!this.canAddMoreItems())
                  return;
            Severity: Minor
            Found in rails/public/javascripts/light_box.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

            Function Class has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            var Class = (function() {
            
              var IS_DONTENUM_BUGGY = (function(){
                for (var p in { toString: 1 }) {
                  if (p === 'toString') return false;
            Severity: Minor
            Found in rails/app/assets/javascripts/prototype.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

            Function displayCompletion has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

              displayCompletion: function(event) {
                var value = this.input.value.strip();
                this.current = null;
                if (!this.canAddMoreItems())
                  return;
            Severity: Minor
            Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.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

            Function start has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

              start: function(options) {
                if (options && options.transition === false) options.transition = Effect.Transitions.linear;
                this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
                this.currentFrame = 0;
                this.state        = 'idle';
            Severity: Minor
            Found in rails/app/assets/javascripts/effects.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

            Function trigger has 93 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                trigger: function( event, data, elem, onlyHandlers ) {
                    // Don't do events on text and comment nodes
                    if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
                        return;
                    }
            Severity: Major
            Found in rails/app/assets/javascripts/jquery/jquery.js - About 3 hrs to fix

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

              export const PortalPermissionFormCreate = props => (
                <Create {...props}>
                  <SimpleForm>
                    <TextInput source="name" />
                    <TextInput source="url" />
              admin-panel/react-admin-interface/src/entities/portalPermissionForm.js on lines 29..39

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

              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 PortalPermissionFormEdit = props => (
                <Edit {...props}>
                  <SimpleForm>
                    <TextInput source="name" />
                    <TextInput source="url" />
              admin-panel/react-admin-interface/src/entities/portalPermissionForm.js on lines 41..51

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

              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

                @Mutation(() => PortalStudentPermissionForm)
                async createPortalStudentPermissionForm(
                @Args() args: CreatePortalStudentPermissionFormArgs) {
                  const createdAt = new Date()
                  const updatedAt = new Date()
              admin-panel/graphql-backend/src/resolvers/AdminProjectUserResolver.ts on lines 127..137

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

              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

                @Mutation(() => AdminProjectUser)
                async createAdminProjectUser(
                  @Args() args: CreateAdminProjectUserArgs) {
                    const createdAt = new Date()
                    const updatedAt = new Date()
              admin-panel/graphql-backend/src/resolvers/PortalStudentPermissionFormResolver.ts on lines 123..133

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

              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 nces_parser.rb has 318 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class NcesParser
              
                def initialize(district_layout_file, school_layout_file, year, states_and_provinces=nil)
                  ## @year_str gets inserted to the db table names
                  @year_str = year.to_s[-2..-1]
              Severity: Minor
              Found in rails/lib/nces_parser.rb - About 3 hrs to fix

                Function send has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                send: function( headers, complete ) {
                
                                    // Get a new xhr
                                    var handle, i,
                                        xhr = s.xhr();
                Severity: Major
                Found in rails/app/assets/javascripts/jquery/jquery.js - About 3 hrs to fix

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

                    getWindow: function(element) {
                      element = $(element);
                  
                      if (!element) return;
                  
                  
                  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 4649..4659
                  rails/public/javascripts/light_box.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

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

                    getWindow: function(element) {
                      element = $(element);
                  
                      if (!element) return;
                  
                  
                  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 2689..2699
                  rails/public/javascripts/light_box.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

                  Severity
                  Category
                  Status
                  Source
                  Language