KarrLab/datanator_frontend

View on GitHub

Showing 165 of 403 total issues

Function formatResults has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  formatResults(data, organism) {
    const results = data["top_kos"]["buckets"];
    const numResults = data["total_buckets"]["value"];

    const formattedResults = [];
Severity: Major
Found in src/scenes/SearchResults/GeneSearchResultsList.js - About 4 hrs to fix

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

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

      Function formatMetadata has 101 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/Gene/MetadataSection.js - About 4 hrs to fix

        Function getSideBarDef has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

            render() {
              if (this.state.metadata && this.state.metadata.error404) {
                return <Error404 />;
              }
          
          
          Severity: Major
          Found in src/scenes/BiochemicalEntityDetails/Gene/Gene.js - About 3 hrs to fix

            File Tutorial.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { Component } from "react";
            import LazyLoad from "react-lazyload";
            import one_home from "./images/1_home.png";
            import search_top from "./images/searchBarTop.png";
            import two_intermediate from "./images/2_intermediate.png";
            Severity: Minor
            Found in src/scenes/Help/Tutorial.js - About 3 hrs to fix

              Function configChart has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                configChart() {
                  if (!this.props.data.values.length) {
                    return;
                  }
              
              
              Severity: Major
              Found in src/scenes/Stats/Plot/FrequencyPlot.js - About 3 hrs to fix

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

                  static formatData(query, organism, rawData) {
                    const formattedData = [];
                
                    for (const datum of rawData) {
                      let enzymeName = null;

                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 23 (exceeds 5 allowed). Consider refactoring.
                Open

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

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

                import React, { Component } from "react";
                import PropTypes from "prop-types";
                import {
                  getNumProperties,
                  upperCaseFirstLetter,

                  Function processRelatedReactions has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static processRelatedReactions(organism, relatedReactions) {
                      const formattedResults = [];
                  
                      for (const reaction of relatedReactions) {
                        const id = reaction.kinlaw_id;
                  Severity: Major
                  Found in src/scenes/BiochemicalEntityDetails/Gene/MetadataSection.js - About 3 hrs to fix

                    File ProteinAbundanceDataTable.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { Component } from "react";
                    import PropTypes from "prop-types";
                    import { getNumProperties, upperCaseFirstLetter } from "~/utils/utils";
                    import DataTable from "../DataTable/DataTable";
                    import { HtmlColumnHeader } from "../HtmlColumnHeader";
                    Severity: Minor
                    Found in src/scenes/BiochemicalEntityDetails/Gene/ProteinAbundanceDataTable.js - About 3 hrs to fix

                      Function FullSiteRouter has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        let FullSiteRouter = () => {
                          return (
                            <ErrorBoundary>
                              <BrowserRouter>
                                <ScrollToTop />
                      Severity: Major
                      Found in src/index.js - About 3 hrs to fix

                        Function getDataFromApi has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function processMetadata has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                            static processMetadata(query, organism, rawData) {
                              let processedData = {};
                              const met = rawData;
                              processedData = {};
                              processedData.synonyms = null;
                          Severity: Minor
                          Found in src/scenes/BiochemicalEntityDetails/Metabolite/MetadataSection.js - 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 updateFilters has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

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

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

                          import React from "react";
                          
                          function matchAll(string, regex) {
                            const matches = [];
                            string.replace(regex, function () {
                          Severity: Minor
                          Found in src/utils/utils.js - About 2 hrs to fix

                            File MetadataSection.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { Component } from "react";
                            import PropTypes from "prop-types";
                            import BaseMetadataSection from "../MetadataSection";
                            import { Link } from "react-router-dom";
                            import { LoadMetabolites } from "../LoadContent";
                            Severity: Minor
                            Found in src/scenes/BiochemicalEntityDetails/Reaction/MetadataSection.js - About 2 hrs to fix

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

                                render() {
                                  if (this.state.all.values == null) {
                                    return <div></div>;
                                  } else {
                                    return (
                              Severity: Major
                              Found in src/scenes/BiochemicalEntityDetails/StatsToolPanel/StatsToolPanel.js - About 2 hrs to fix

                                Function configChart has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  configChart() {
                                    if (!this.props.data.values.length) {
                                      return;
                                    }
                                
                                
                                Severity: Major
                                Found in src/scenes/Stats/Plot/BarPlot.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language