concord-consortium/rigse

View on GitHub
rails/react-components/src/library/components/stem-finder.tsx

Summary

Maintainability
F
1 wk
Test Coverage

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

import React from "react";

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

    StemFinder has 39 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const StemFinder = Component({
    
      getInitialState () {
        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 5 hrs to fix

      Function search has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        search (incremental: any) {
          const displayLimit = incremental ? this.state.displayLimit + DISPLAY_LIMIT_INCREMENT : DISPLAY_LIMIT_INCREMENT;
      
          // short circuit further incremental searches when all data has been downloaded
          if (incremental && (this.state.lastSearchResultCount === 0)) {
      Severity: Major
      Found in rails/react-components/src/library/components/stem-finder.tsx - About 2 hrs to fix

        Function getInitialState has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getInitialState () {
            const hideFeatured = this.props.hideFeatured || false;
            let subjectAreaKey = this.props.subjectAreaKey;
            let gradeLevelKey = this.props.gradeLevelKey;
            const sortOrder = this.props.sortOrder || "";
        Severity: Major
        Found in rails/react-components/src/library/components/stem-finder.tsx - About 2 hrs to fix

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

            getInitialState () {
              const hideFeatured = this.props.hideFeatured || false;
              let subjectAreaKey = this.props.subjectAreaKey;
              let gradeLevelKey = this.props.gradeLevelKey;
              const sortOrder = this.props.sortOrder || "";
          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

          Function getQueryParams has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getQueryParams (incremental: any, keyword: any) {
              const searchPage = incremental ? this.state.searchPage + 1 : 1;
              let query = keyword !== undefined ? ["search_term=", encodeURIComponent(keyword)] : [];
              query = query.concat([
                "&skip_lightbox_reloads=true",
          Severity: Minor
          Found in rails/react-components/src/library/components/stem-finder.tsx - About 1 hr to fix

            Function renderGLLogo has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderGLLogo (gradeLevel: any) {
                let className = "portal-pages-finder-form-filters-logo";
                const filterId = this.buildFilterId(gradeLevel.key);
            
                const selected = this.state.gradeLevelsSelectedMap[gradeLevel.key];
            Severity: Minor
            Found in rails/react-components/src/library/components/stem-finder.tsx - About 1 hr to fix

              Function renderLogo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderLogo (subjectArea: any) {
                  const filterId = this.buildFilterId(subjectArea.key);
                  const selected = this.state.subjectAreasSelectedMap[subjectArea.key];
                  const className = selected ? css.selected : null;
              
              
              Severity: Minor
              Found in rails/react-components/src/library/components/stem-finder.tsx - About 1 hr to fix

                Function renderResultsHeader has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  renderResultsHeader () {
                    const { displayLimit, noResourcesFound, numTotalResources, searching, usersAuthoredResourcesCount } = this.state;
                    const finderHeaderClass = this.isAdvancedUser() || usersAuthoredResourcesCount > 0 ? `${css.finderHeader} ${css.advanced}` : css.finderHeader;
                
                    if (noResourcesFound || searching) {
                Severity: Minor
                Found in rails/react-components/src/library/components/stem-finder.tsx - About 1 hr to fix

                  Function renderResultsHeader has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    renderResultsHeader () {
                      const { displayLimit, noResourcesFound, numTotalResources, searching, usersAuthoredResourcesCount } = this.state;
                      const finderHeaderClass = this.isAdvancedUser() || usersAuthoredResourcesCount > 0 ? `${css.finderHeader} ${css.advanced}` : css.finderHeader;
                  
                      if (noResourcesFound || searching) {
                  Severity: Minor
                  Found in rails/react-components/src/library/components/stem-finder.tsx - About 1 hr 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 search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    search (incremental: any) {
                      const displayLimit = incremental ? this.state.displayLimit + DISPLAY_LIMIT_INCREMENT : DISPLAY_LIMIT_INCREMENT;
                  
                      // short circuit further incremental searches when all data has been downloaded
                      if (incremental && (this.state.lastSearchResultCount === 0)) {
                  Severity: Minor
                  Found in rails/react-components/src/library/components/stem-finder.tsx - About 25 mins 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

                      const clicked = function () {
                        const gradeLevelsSelected = this.state.gradeLevelsSelected.slice();
                        const gradeLevelsSelectedMap = this.state.gradeLevelsSelectedMap;
                        const index = gradeLevelsSelected.indexOf(gradeLevel);
                  
                  
                  rails/react-components/src/library/components/stem-finder.tsx on lines 341..365

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

                  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 = function () {
                        const subjectAreasSelected = this.state.subjectAreasSelected.slice();
                        const subjectAreasSelectedMap = this.state.subjectAreasSelectedMap;
                        const index = subjectAreasSelected.indexOf(subjectArea);
                  
                  
                  rails/react-components/src/library/components/stem-finder.tsx on lines 383..407

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

                  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

                    renderSubjectAreas () {
                      const containerClassName = this.state.isSmallScreen ? css.finderOptionsContainer : `${css.finderOptionsContainer} ${css.open}`;
                      return (
                        <div className={containerClassName}>
                          <h2 onClick={this.handleFilterHeaderClick}>Subject</h2>
                  rails/react-components/src/library/components/stem-finder.tsx on lines 430..442

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

                  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

                    renderGradeLevels () {
                      const containerClassName = this.state.isSmallScreen ? css.finderOptionsContainer : `${css.finderOptionsContainer} ${css.open}`;
                      return (
                        <div className={containerClassName}>
                          <h2 onClick={this.handleFilterHeaderClick}>Grade Level</h2>
                  rails/react-components/src/library/components/stem-finder.tsx on lines 416..428

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

                  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 (subjectAreaKey) {
                        const subjectAreas = filters.subjectAreas;
                        for (i = 0; i < subjectAreas.length; i++) {
                          const subjectArea = subjectAreas[i];
                          if (subjectArea.key === subjectAreaKey) {
                  rails/react-components/src/library/components/stem-finder.tsx on lines 64..73

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

                  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 (gradeLevelKey) {
                        const gradeLevels = filters.gradeLevels;
                        for (i = 0; i < gradeLevels.length; i++) {
                          const gradeLevel = gradeLevels[i];
                          if (gradeLevel.key === gradeLevelKey) {
                  rails/react-components/src/library/components/stem-finder.tsx on lines 50..59

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

                  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

                    handleCommunityClick (e: any) {
                      e.currentTarget.classList.toggle(css.selected);
                      this.setState({
                        hideFeatured: true,
                        includeContributed: !this.state.includeContributed
                  rails/react-components/src/library/components/stem-finder.tsx on lines 444..454

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

                  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

                    handleOfficialClick (e: any) {
                      e.currentTarget.classList.toggle(css.selected);
                      this.setState({
                        hideFeatured: true,
                        includeOfficial: !this.state.includeOfficial
                  rails/react-components/src/library/components/stem-finder.tsx on lines 456..466

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

                  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 (
                        scrollTop > window.innerHeight / 2 &&
                        !this.state.searching &&
                        this.state.resources.length !== 0 &&
                        !(this.state.displayLimit >= this.state.numTotalResources)
                  rails/react-components/src/library/components/stem-finder.tsx on lines 155..162

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

                  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 (
                        scrollTop > window.innerHeight / 3 &&
                        !this.state.searching &&
                        this.state.resources.length !== 0 &&
                        !(this.state.displayLimit >= this.state.numTotalResources)
                  rails/react-components/src/library/components/stem-finder.tsx on lines 143..150

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

                  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 (document.getElementById("pprfl")) {
                        document.getElementById("pprfl")?.addEventListener("scroll", this.handleLightboxScroll);
                      } else {
                        document.addEventListener("scroll", this.handlePageScroll);
                      }
                  rails/react-components/src/library/components/stem-finder.tsx on lines 178..182

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

                  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 (document.getElementById("pprfl")) {
                        document.getElementById("pprfl")?.removeEventListener("scroll", this.handleLightboxScroll);
                      } else {
                        document.removeEventListener("scroll", this.handlePageScroll);
                      }
                  rails/react-components/src/library/components/stem-finder.tsx on lines 166..170

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

                  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

                      return (
                        <li key={subjectArea.key} id={css[filterId]} className={className} onClick={clicked}>
                          { subjectArea.title }
                        </li>
                      );
                  rails/react-components/src/library/components/stem-finder.tsx on lines 409..413

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

                  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

                      return (
                        <li key={gradeLevel.key} id={css[filterId]} className={className} onClick={clicked}>
                          { gradeLevel.title }
                        </li>
                      );
                  rails/react-components/src/library/components/stem-finder.tsx on lines 367..371

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

                  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 (gradeFilter.searchGroups) {
                          gradeFilter.searchGroups.forEach(function (searchGroup: any) {
                            query.push("&grade_level_groups[]=");
                            query.push(encodeURIComponent(searchGroup));
                          });
                  Severity: Minor
                  Found in rails/react-components/src/library/components/stem-finder.tsx and 1 other location - About 55 mins to fix
                  rails/react-components/src/library/components/stem-finder.tsx on lines 206..211

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

                  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

                      this.state.subjectAreasSelected.forEach(function (subjectArea: any) {
                        subjectArea.searchAreas.forEach(function (searchArea: any) {
                          query.push("&subject_areas[]=");
                          query.push(encodeURIComponent(searchArea));
                        });
                  Severity: Minor
                  Found in rails/react-components/src/library/components/stem-finder.tsx and 1 other location - About 55 mins to fix
                  rails/react-components/src/library/components/stem-finder.tsx on lines 215..220

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

                  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

                  There are no issues that match your filters.

                  Category
                  Status