KarrLab/datanator_frontend

View on GitHub

Showing 165 of 403 total issues

Function formatData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  formatData(query, organism, rawData) {
    const formattedData = [];
    for (const rawDatum of rawData) {
      if ("modifications" in rawDatum && rawDatum.modifications) {
        for (const measurement of rawDatum.modifications) {

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

  render() {
    return (
      <bruit-io
        brt-config={JSON.stringify({
          apiKey: API_KEY,
Severity: Minor
Found in src/components/FeedbackForm/FeedbackForm.js - About 1 hr to fix

    Function formatDocuments has 44 lines of code (exceeds 25 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;

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

        render() {
          return (
            <div className="content-container content-container-search-results-scene">
              <h1 className="page-title">
                Search: <span className="highlight-accent">{this.state.query}</span>
      Severity: Minor
      Found in src/scenes/SearchResults/SearchResults.js - About 1 hr to fix

        Function updateBounds has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          updateBounds() {
            this.loBound = this.props.loBound;
            this.hiBound = this.props.hiBound;
        
            if (this.loBound == null || this.hiBound == null) {
        Severity: Minor
        Found in src/scenes/BiochemicalEntityDetails/NumberFilter.js - 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 dictOfArraysToArrayOfDicts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function dictOfArraysToArrayOfDicts(dictOfArrays) {
          const arrayOfDicts = [];
          for (const key in dictOfArrays) {
            if (Array.isArray(dictOfArrays[key])) {
              for (let iEl = 0; iEl < dictOfArrays[key].length; iEl++) {
        Severity: Minor
        Found in src/utils/utils.js - 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 getMatchingOrganisms has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getMatchingOrganisms(query, event) {
            // Blueprint appears to issue two calls per input change; ignore the one with no defined event
            if (!event) {
              return;
            }
        Severity: Minor
        Found in src/components/SearchForm/SearchForm.js - About 1 hr to fix

          Function replaceNanWithNull has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function replaceNanWithNull(value) {
            if (Number.isNaN(value)) {
              return null;
            }
          
          
          Severity: Minor
          Found in src/utils/utils.js - About 1 hr to fix

            Function updateFilters has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              updateFilters(event) {
                const filters = [];
                for (const colApi of event.columnApi.getAllGridColumns()) {
                  const colDef = colApi.colDef;
            
            

              Function doesFilterPass has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                doesFilterPass(params) {
                  if (this.selectedVals.size === 0) {
                    return true;
                  } else {
                    const getter = this.props.filterValueGetter || this.props.valueGetter;
              Severity: Minor
              Found in src/scenes/BiochemicalEntityDetails/TextFilter.js - 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 calcStats has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                calcStats(nodes) {
                  // get values
                  const vals = [];
                  const nonNullVals = [];
                  for (const node of nodes) {

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

                  render() {
                    const results = this.state.results;
                    const numResults = this.state.numResults;
                    const pageSize = this.props["page-size"];
                    const numMore = Math.min(pageSize, numResults - pageSize * this.pageCount);
                Severity: Minor
                Found in src/scenes/SearchResults/SearchResultsList.js - About 1 hr to fix

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

                    static processMetadata(query, organism, rawData) {
                      const processedData = {};
                  
                      const reactionId = MetadataSection.getReactionId(rawData[0].resource);
                      const ecNumber = MetadataSection.getEcNum(rawData[0].resource);
                  Severity: Minor
                  Found in src/scenes/BiochemicalEntityDetails/Reaction/MetadataSection.js - About 1 hr to fix

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

                      render() {
                        return (
                          <div
                            className={
                              "ag-cell-label-container ag-header-cell-sorted-" + this.state.sort
                    Severity: Minor
                    Found in src/scenes/BiochemicalEntityDetails/HtmlColumnHeader.js - About 1 hr to fix

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

                        static calcTaxonomicDistance(taxonDistance, targetSpecies, measuredSpecies) {
                          let distance = null;
                      
                          targetSpecies = targetSpecies.toLowerCase();
                          measuredSpecies = measuredSpecies.toLowerCase();
                      Severity: Minor
                      Found in src/scenes/BiochemicalEntityDetails/DataTable/DataTable.js - About 1 hr to fix

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

                          static getColSortOrder(query, organism, formattedData) {
                            const sortOrder = [
                              { colId: "taxonomicProximity", sort: "asc" },
                              { colId: "organism", sort: "asc" },
                            ];

                          Function processRelatedReactions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                            static processRelatedReactions(organism, relatedReactions) {
                              const formattedResults = [];
                          
                              for (const reaction of relatedReactions) {
                                const id = reaction.kinlaw_id;
                          Severity: Minor
                          Found in src/scenes/BiochemicalEntityDetails/Gene/MetadataSection.js - 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 getColSortOrder has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                            static getColSortOrder(query, organism, formattedData) {
                              const sortOrder = [
                                { colId: "taxonomicProximity", sort: "asc" },
                                { colId: "organism", sort: "asc" },
                              ];

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

                            static getSideBarDef(query, organism, formattedData) {
                              const sideBar = {
                                toolPanels: [
                                  {
                                    id: "columns",

                          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 getReactantNames has a Cognitive Complexity of 12 (exceeds 5 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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language