KarrLab/datanator_frontend

View on GitHub

Showing 403 of 403 total issues

File ConcentrationDataTable.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from "react";
import PropTypes from "prop-types";
import { upperCaseFirstLetter } from "~/utils/utils";
import DataTable from "../DataTable/DataTable";
import Tooltip from "@material-ui/core/Tooltip";

    File Stats.js has 383 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component } from "react";
    import { HashLink } from "react-router-hash-link";
    import { scrollTo } from "~/utils/utils";
    import BarPlot from "./Plot/BarPlot";
    import FrequencyPlot from "./Plot/FrequencyPlot";
    Severity: Minor
    Found in src/scenes/Stats/Stats.js - About 5 hrs to fix

      Function processDescriptionFromUniprot has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static processDescriptionFromUniprot(query, data) {
          if (data == null || data.length === 0) {
            return MetadataSection.blankResponse;
          }
      
      
      Severity: Major
      Found in src/scenes/BiochemicalEntityDetails/Gene/MetadataSection.js - About 5 hrs to fix

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

          componentDidMount() {
            this.setState({ locationPathname: this.props.history.location.pathname });
            this.unlistenToHistory = this.props.history.listen((location) => {
              if (location.pathname !== this.state.locationPathname) {
                this.setState({ locationPathname: location.pathname });
        Severity: Major
        Found in src/scenes/SearchResults/SearchResultsList.js and 1 other location - About 5 hrs to fix
        src/scenes/BiochemicalEntityDetails/Metabolite/SearchResultsList.js on lines 40..49

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

        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

          componentDidMount() {
            this.setState({ locationPathname: this.props.history.location.pathname });
            this.unlistenToHistory = this.props.history.listen((location) => {
              if (location.pathname !== this.state.locationPathname) {
                this.setState({ locationPathname: location.pathname });
        src/scenes/SearchResults/SearchResultsList.js on lines 40..49

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

        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

          getUrl(query, organism) {
            if (isOrthoDbId(query)) {
              const args = ["kegg_id=" + query, "distance=40"];
              if (organism) {
                args.push("anchor=" + organism);
        src/scenes/BiochemicalEntityDetails/Gene/ProteinModificationDataTable.js on lines 23..41

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

        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

          getUrl(query, organism) {
            if (isOrthoDbId(query)) {
              const args = ["kegg_id=" + query, "distance=40"];
              if (organism) {
                args.push("anchor=" + organism);
        src/scenes/BiochemicalEntityDetails/Gene/ProteinAbundanceDataTable.js on lines 20..38

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

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

        function replaceNanWithNull(value) {
          if (Number.isNaN(value)) {
            return null;
          }
        
        
        Severity: Minor
        Found in src/utils/utils.js - About 5 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 getColDefs has 125 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static getColDefs(query, organism, formattedData, taxonomicRanks) {
            const colDefs = [
              {
                headerName: "Processing",
                field: "processing",

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

            componentDidMount() {
              this.locationPathname = this.props.history.location.pathname;
              this.unlistenToHistory = this.props.history.listen((location) => {
                if (location.pathname !== this.locationPathname) {
                  this.locationPathname = this.props.history.location.pathname;
          Severity: Major
          Found in src/scenes/BiochemicalEntityDetails/MetadataSection.js and 1 other location - About 4 hrs to fix
          src/scenes/BiochemicalEntityDetails/DataTable/DataTable.js on lines 108..117

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

          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

            componentDidMount() {
              this.locationPathname = this.props.history.location.pathname;
              this.unlistenToHistory = this.props.history.listen((location) => {
                if (location.pathname !== this.locationPathname) {
                  this.locationPathname = this.props.history.location.pathname;
          Severity: Major
          Found in src/scenes/BiochemicalEntityDetails/DataTable/DataTable.js and 1 other location - About 4 hrs to fix
          src/scenes/BiochemicalEntityDetails/MetadataSection.js on lines 30..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 134.

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

            formatDocuments(uniprotId, organism, taxonDistance, rawData, formattedData) {
              for (const rawDatum of rawData) {
                if ("abundances" in rawDatum && rawDatum.abundances) {
                  for (const measurement of rawDatum.abundances) {
                    let proteinName = rawDatum.protein_name;
          Severity: Minor
          Found in src/scenes/BiochemicalEntityDetails/Gene/ProteinAbundanceDataTable.js - About 4 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 formatDocuments has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

            formatDocuments(organism, taxonDistance, rawData, formattedData) {
              for (const rawDatum of rawData) {
                if ("modifications" in rawDatum && rawDatum.modifications) {
                  for (const measurement of rawDatum.modifications) {
                    if (

          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

                        <li className="tutorial-step">
                          <div className="tutorial-step-title">
                            Export the data for model construction, calibration, and/or
                            validation.
                          </div>
          Severity: Major
          Found in src/scenes/Help/Tutorial.js and 1 other location - About 4 hrs to fix
          src/scenes/Help/Tutorial.js on lines 259..281

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

          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

                        <li className="tutorial-step">
                          <div className="tutorial-step-title">
                            Visualize the distribution of all of the measurements or a
                            selected subset of the mesurements.
                          </div>
          Severity: Major
          Found in src/scenes/Help/Tutorial.js and 1 other location - About 4 hrs to fix
          src/scenes/Help/Tutorial.js on lines 282..299

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

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

            static formatData(query, organism, rawData) {
              const formattedData = [];
              for (const rawDatum of rawData) {
                if ("halflives" in rawDatum && rawDatum.halflives) {
                  const measurements = rawDatum.halflives;
          Severity: Major
          Found in src/scenes/BiochemicalEntityDetails/Gene/RnaHalfLifeDataTable.js - About 4 hrs to fix

            Function formatData has 121 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static formatData(query, organism, rawData) {
                const formattedData = [];
                for (const metabolite of rawData) {
                  if ("concentrations" in metabolite && metabolite.concentrations) {
                    for (const metConc of metabolite["concentrations"]) {

              File RnaHalfLifeDataTable.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { Component } from "react";
              import PropTypes from "prop-types";
              import {
                upperCaseFirstLetter,
                isOrthoDbId,
              Severity: Minor
              Found in src/scenes/BiochemicalEntityDetails/Gene/RnaHalfLifeDataTable.js - About 4 hrs to fix

                Function getColDefs has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  static getColDefs(query, organism, formattedData, taxonomicRanks) {
                    const colDefs = [
                      {
                        headerName: "Abundance",
                        field: "abundance",
                Severity: Major
                Found in src/scenes/BiochemicalEntityDetails/Gene/ProteinAbundanceDataTable.js - About 4 hrs to fix

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

                    render() {
                      return (
                        <DataTable
                          id="protein-abundance"
                          title="Protein abundance"
                  src/scenes/BiochemicalEntityDetails/Gene/ProteinModificationDataTable.js on lines 305..321
                  src/scenes/BiochemicalEntityDetails/Gene/RnaModificationDataTable.js on lines 207..223

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

                  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