KarrLab/datanator_frontend

View on GitHub
src/scenes/Stats/Stats.js

Summary

Maintainability
F
6 days
Test Coverage
C
79%

Function componentDidMount has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  componentDidMount() {
    // number of observations of each data type
    const dataTypeData = [];
    dataTypeData.push({
      label: ["Met. concs."],
Severity: Major
Found in src/scenes/Stats/Stats.js - About 5 hrs to fix

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

      render() {
        return (
          <div className="content-container content-container-stats-scene">
            <h1 className="page-title">
              Statistics:{" "}
    Severity: Major
    Found in src/scenes/Stats/Stats.js - About 5 hrs to fix

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

          constructor() {
            super();
            this.state = {
              dataType: {
                labels: [],
        Severity: Minor
        Found in src/scenes/Stats/Stats.js - About 1 hr to fix

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

                      <div className="section-columns section-2-columns">
                        <div className="section section-column" id="data-type">
                          <h2 className="content-block-heading">
                            Distribution of the types of the measurements
                          </h2>
          Severity: Major
          Found in src/scenes/Stats/Stats.js and 1 other location - About 7 hrs to fix
          src/scenes/Stats/Stats.js on lines 393..417

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

          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

                      <div className="section-columns section-2-columns">
                        <div className="section section-column" id="immediate-source">
                          <h2 className="content-block-heading">
                            Immediate sources of the measurements
                          </h2>
          Severity: Major
          Found in src/scenes/Stats/Stats.js and 1 other location - About 7 hrs to fix
          src/scenes/Stats/Stats.js on lines 333..357

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

          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>
                              <HashLink scroll={scrollTo} to="#immediate-source">
                                Sources
                              </HashLink>
                              <ul>
          Severity: Major
          Found in src/scenes/Stats/Stats.js and 1 other location - About 4 hrs to fix
          src/scenes/Stats/Stats.js on lines 293..309

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

          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>
                              <HashLink scroll={scrollTo} to="#temperature">
                                Env. conditions
                              </HashLink>
                              <ul>
          Severity: Major
          Found in src/scenes/Stats/Stats.js and 1 other location - About 4 hrs to fix
          src/scenes/Stats/Stats.js on lines 310..326

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

          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

                        <div className="section section-column" id="ph">
                          <h2 className="content-block-heading">
                            pH distribution of the measurements
                          </h2>
                          <div className="content-block-content">
          Severity: Major
          Found in src/scenes/Stats/Stats.js and 1 other location - About 3 hrs to fix
          src/scenes/Stats/Stats.js on lines 360..374

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

          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

                        <div className="section section-column" id="temperature">
                          <h2 className="content-block-heading">
                            Temperature distribution of the measurements
                          </h2>
                          <div className="content-block-content">
          Severity: Major
          Found in src/scenes/Stats/Stats.js and 1 other location - About 3 hrs to fix
          src/scenes/Stats/Stats.js on lines 376..390

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

          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

          There are no issues that match your filters.

          Category
          Status