KarrLab/datanator_frontend

View on GitHub

Showing 165 of 403 total issues

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

  static getColDefs(query, organism, formattedData, taxonomicRanks) {
    const colDefs = [
      {
        headerName: "Half-life",
        headerComponentFramework: HtmlColumnHeader,
Severity: Major
Found in src/scenes/BiochemicalEntityDetails/Gene/RnaHalfLifeDataTable.js - About 5 hrs to fix

    Function getColDefs has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

      static getColDefs(query, organism, formattedData, taxonomicRanks) {
        const colDefs = [];
    
        // k_cat column
        let hasKcat = false;

    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 MetadataSection.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component } from "react";
    import PropTypes from "prop-types";
    import { formatChemicalFormula, strCompare, castToArray } from "~/utils/utils";
    import BaseMetadataSection from "../MetadataSection";
    import LazyLoad from "react-lazyload";
    Severity: Minor
    Found in src/scenes/BiochemicalEntityDetails/Metabolite/MetadataSection.js - About 5 hrs to fix

      File Reaction.test.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { RateConstantsDataTable } from "~/scenes/BiochemicalEntityDetails/Reaction/RateConstantsDataTable";
      import testRawData from "~/__tests__/fixtures/reaction-constants-adenylate-kinase";
      import { MetadataSection } from "~/scenes/BiochemicalEntityDetails/Reaction/MetadataSection";
      import { shallow } from "enzyme";
      import { getListDomElements, getSectionFromList } from "~/utils/testing_utils";
      Severity: Minor
      Found in src/__tests__/scenes/BiochemicalEntityDetails/Reaction.test.js - About 5 hrs to fix

        Function processMetadata has 132 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static processMetadata(query, organism, rawData) {
            let processedData = {};
            const met = rawData;
            processedData = {};
            processedData.synonyms = null;
        Severity: Major
        Found in src/scenes/BiochemicalEntityDetails/Metabolite/MetadataSection.js - About 5 hrs to fix

          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

                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",

                  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

                  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

                          Function getMetadataFromApi has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            getMetadataFromApi() {
                              const route = parseHistoryLocationPathname(this.props.history);
                              const query = route.query;
                              const organism = route.organism;
                          
                          
                          Severity: Major
                          Found in src/scenes/BiochemicalEntityDetails/MetadataSection.js - About 4 hrs to fix

                            Function render has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const entityTooltip = (
                                  <div>
                                    <p>
                                      Enter the id or name of a metabolite, gene, or reaction to search for
                            Severity: Major
                            Found in src/components/SearchForm/SearchForm.js - About 4 hrs to fix

                              Function formatResults has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                              Open

                                formatResults(data, organism) {
                                  const results = data["top_kos"]["buckets"];
                                  const numResults = data["total_buckets"]["value"];
                              
                                  const formattedResults = [];
                              Severity: Minor
                              Found in src/scenes/SearchResults/GeneSearchResultsList.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 formatMetadata has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                static formatMetadata(query, organism, processedData) {
                                  const sections = [];
                              
                                  sections.push({
                                    id: "id",
                              Severity: Major
                              Found in src/scenes/BiochemicalEntityDetails/Reaction/MetadataSection.js - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language