KarrLab/datanator_frontend

View on GitHub

Showing 165 of 403 total issues

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

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

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

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

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

  static processRelatedMetabolites(partLinks, metabolites, organism) {
    metabolites.sort((a, b) => {
      return naturalSort(a.name, b.name);
    });

Severity: Minor
Found in src/scenes/BiochemicalEntityDetails/Reaction/MetadataSection.js - About 1 hr to fix

    Function getResultsUrl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getResultsUrl(query, pageCount, pageSize) {
        const indexQueryArg = "metabolites_meta";
    
        return (
          "ftx/text_search/num_of_index/?" +
    Severity: Minor
    Found in src/scenes/SearchResults/MetaboliteSearchResultsList.js - About 1 hr to fix

      Function fetchResults has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        fetchResults() {
          const url = this.props["get-results-url"](
            this.query,
            this.pageCount,
            this.props["page-size"]
      Severity: Minor
      Found in src/scenes/BiochemicalEntityDetails/Metabolite/SearchResultsList.js - About 1 hr to fix

        Function getReactantNames has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static getReactantNames(reactants, reactant_type) {
            let structure_id = null;
            let name_id = null;
            if (reactant_type === "substrate") {
              structure_id = "substrate_structure";
        Severity: Minor
        Found in src/scenes/BiochemicalEntityDetails/Reaction/MetadataSection.js - About 1 hr to fix

          Function cellRenderer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                cellRenderer: function (params) {
                  const subunits = params.value;
                  if (subunits != null) {
                    return (
                      '<ul class="comma-separated-list">' +

            Function fetchResults has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              fetchResults() {
                const url = this.props["get-results-url"](
                  this.query,
                  this.pageCount,
                  this.props["page-size"]
            Severity: Minor
            Found in src/scenes/SearchResults/SearchResultsList.js - About 1 hr to fix

              Function calcTaxonomicRanks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static calcTaxonomicRanks(organismData) {
                  const ranks = [];
                  for (let iLineage = 0; iLineage < organismData.length; iLineage++) {
                    const lineage = organismData[iLineage];
                    let rank;
              Severity: Minor
              Found in src/scenes/BiochemicalEntityDetails/DataTable/DataTable.js - About 1 hr to fix

                Function updateVals has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  updateVals() {
                    const unorderedVals = new Set();
                    this.props.api.forEachNode((node) => {
                      const getter = this.props.filterValueGetter || this.props.valueGetter;
                      const value = getter(node);
                Severity: Minor
                Found in src/scenes/BiochemicalEntityDetails/TextFilter.js - About 1 hr to fix

                  Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    constructor(props) {
                      super(props);
                  
                      this.loBound = 0;
                      this.hiBound = 1;
                  Severity: Minor
                  Found in src/scenes/BiochemicalEntityDetails/NumberFilter.js - About 1 hr to fix

                    Function formatScientificNotation has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      value,
                      sciMagUpThresh = 1,
                      sciMagDownThresh = 1,
                      sciDecimals = 1,
                      fixedDeminals = 1,
                    Severity: Major
                    Found in src/utils/utils.js - About 50 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                } else if ("values" in measurement) {
                                  const cellLineValues = {};
                      
                                  for (const value of measurement.values) {
                                    let cellLine;
                      Severity: Major
                      Found in src/scenes/BiochemicalEntityDetails/Gene/RnaHalfLifeDataTable.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if ("taxon_distance" in rawDatum) {
                                      formattedDatum[
                                        "taxonomicProximity"
                                      ] = DataTable.calcTaxonomicDistance(
                                        rawDatum.taxon_distance,
                        Severity: Major
                        Found in src/scenes/BiochemicalEntityDetails/Gene/ProteinAbundanceDataTable.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      if (datum.gene[0].olnNames[0].value) {
                                        geneName = datum.gene[0].olnNames[0].value;
                                      } else if (
                                        datum.gene[0].olnNames[0].evidences &&
                                        datum.gene[0].olnNames[0].evidences.length
                          Severity: Major
                          Found in src/scenes/BiochemicalEntityDetails/Gene/MetadataSection.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if (organism != null) {
                                          formattedDatum[
                                            "taxonomicProximity"
                                          ] = DataTable.calcTaxonomicDistance(
                                            measurement.taxon_distance,
                            Severity: Major
                            Found in src/scenes/BiochemicalEntityDetails/Gene/RnaHalfLifeDataTable.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                      for (const key in val) {
                                        const v = val[key];
                                        if (Number.isNaN(v)) {
                                          val[key] = null;
                                        } else if (
                              Severity: Major
                              Found in src/utils/utils.js - About 45 mins to fix

                                Function configChart has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  configChart() {
                                    if (!this.props.data.values.length) {
                                      return;
                                    }
                                
                                
                                Severity: Minor
                                Found in src/scenes/Stats/Plot/FrequencyPlot.js - About 45 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

                                Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  render() {
                                    if (this.state.metadata && this.state.metadata.error404) {
                                      return <Error404 />;
                                    }
                                
                                
                                Severity: Minor
                                Found in src/scenes/BiochemicalEntityDetails/Gene/Gene.js - About 45 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

                                Avoid deeply nested control flow statements.
                                Open

                                          if (Number.isNaN(v)) {
                                            val[i] = null;
                                          } else if (
                                            v != null &&
                                            v !== undefined &&
                                Severity: Major
                                Found in src/utils/utils.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language