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

    function delayAddClass( el, className /*, className2*/ ) {
        var classes = dummyArray.slice.call( arguments, 1 ),
            i = classes.length;
        setTimeout( function() {
            if( el ) {
Severity: Major
Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3965..3975

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

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

        { links.assign_collection ? <a className="portal-pages-secondary-button" href={`${links.assign_collection.url}`} onClick={this.handleAddToCollectionClick} target="_blank" rel="noreferrer">{ links.assign_collection.text }</a> : null }
rails/react-components/src/library/components/resource-lightbox.tsx on lines 398..398

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

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

        { links.assign_collection ? <a className="portal-pages-secondary-button" href={`${links.assign_collection.url}`} onClick={this.handleAddToCollectionClick} target="_blank" rel="noreferrer">{ links.assign_collection.text }</a> : null }
rails/react-components/src/library/components/browse-page/browse-page.tsx on lines 213..213

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

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 class PortalCoursesGradeLevels {
  @Column("int", { name: "grade_level_id", nullable: true })
  gradeLevelId: number | null;

  @Column("int", { name: "course_id", nullable: true })
admin-panel/graphql-backend/src/entities/unused/PortalGradeLevelsTeachers.ts on lines 4..10

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

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 class PortalGradeLevelsTeachers {
  @Column("int", { name: "grade_level_id", nullable: true })
  gradeLevelId: number | null;

  @Column("int", { name: "teacher_id", nullable: true })
admin-panel/graphql-backend/src/entities/unused/PortalCoursesGradeLevels.ts on lines 4..10

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

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

        superMatcher = function( seed, context, xml, results, expandContext ) {
            var elem, j, matcher,
                setMatched = [],
                matchedCount = 0,
                i = "0",
Severity: Major
Found in rails/app/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

    Function superMatcher has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          superMatcher = function( seed, context, xml, results, outermost ) {
            var elem, j, matcher,
              matchedCount = 0,
              i = "0",
              unmatched = seed && [],
    Severity: Major
    Found in rails/app/assets/javascripts/prototype.js - About 2 hrs to fix

      Method add_materials_standard has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def add_materials_standard
      
          key     = ENV['ASN_API_KEY']
          uri     = params[:identifier]
          type    = params[:material_type]
      Severity: Major
      Found in rails/app/controllers/api/v1/materials_controller.rb - About 2 hrs to fix

        Function parseColor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        String.prototype.parseColor = function() {
          var color = '#';
          if (this.slice(0,4) == 'rgb(') {
            var cols = this.slice(4,this.length-1).split(',');
            var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
        Severity: Minor
        Found in rails/app/assets/javascripts/effects.js - About 2 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 setDimensions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          setDimensions: function(height, width) {
            var d = { };
            if (this.options.scaleX) d.width = width.round() + 'px';
            if (this.options.scaleY) d.height = height.round() + 'px';
            if (this.options.scaleFromCenter) {
        Severity: Minor
        Found in rails/app/assets/javascripts/effects.js - About 2 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 setup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          setup: function(){
            function parseColor(color){
              if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
              color = color.parseColor();
              return $R(0,2).map(function(i){
        Severity: Minor
        Found in rails/app/assets/javascripts/effects.js - About 2 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 update_class_and_teachers has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_class_and_teachers(portal_clazz, object_params)
            updated_class = portal_clazz.update(portal_clazz_strong_params(object_params))
            if updated_class
              class_name_changed = portal_clazz.saved_change_to_attribute?(:name)
        
        
        Severity: Minor
        Found in rails/app/controllers/portal/clazzes_controller.rb - About 2 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 visible? has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def visible?
        
            #
            # Admins or material admins can view all.
            #
        Severity: Minor
        Found in rails/app/policies/material_shared_policy.rb - About 2 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 create_default_assignments_for_class has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.create_default_assignments_for_class
            #this method assigns study materials to the classes
            DEFAULT_DATA[:assignments].each do |assignment_key, assignment|
              clazz = @default_classes.find{|c| c.name == assignment[:class_name]}
              if clazz
        Severity: Minor
        Found in rails/lib/mock_data/create_default_data.rb - About 2 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 _parse_file_using_import has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def _parse_file_using_import(file, layout, model)
            attributes = {}
            count = 0
            value_sets = []
            column_names = model.columns.map{ |column| column.name }
        Severity: Minor
        Found in rails/lib/nces_parser.rb - About 2 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 query has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          query (_params: any, fieldName?: any, searchString?: any) {
            if (fieldName) {
              this.setState({ [`waitingFor_${fieldName}`]: true });
            }
        
        

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

          constructor(props: Props) {
            super(props);
        
            const hideFeatured = this.props.hideFeatured || false;
            let subjectAreaKey = this.props.subjectAreaKey;
        Severity: Minor
        Found in rails/react-components/src/library/components/stem-finder.tsx - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        File library.tsx has 267 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { createElement } from "react";
        import ReactDOM from "react-dom/client";
        
        import CollectionsPage from "./components/collections-page";
        import CollectionCards from "./components/collection-cards";
        Severity: Minor
        Found in rails/react-components/src/library/library.tsx - About 2 hrs to fix

          Function lambdaHandler has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.lambdaHandler = async (event, context) => {
              try {
                const body = validateJSON(event);
          
                if (body.jwt) {
          Severity: Major
          Found in external-report-demo/report-demo/app.js - About 2 hrs to fix

            Function Serializers has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Form.Element.Serializers = (function() {
              function input(element, value) {
                switch (element.type.toLowerCase()) {
                  case 'checkbox':
                  case 'radio':
            Severity: Major
            Found in rails/app/assets/javascripts/prototype.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language