GladysProject/Gladys

View on GitHub
front/src/routes/map/NewArea.jsx

Summary

Maintainability
C
1 day
Test Coverage

File NewArea.jsx has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Text, Localizer } from 'preact-i18n';
import { Link } from 'preact-router/match';
import { Component } from 'preact';
import { connect } from 'unistore/preact';
import { route } from 'preact-router';
Severity: Minor
Found in front/src/routes/map/NewArea.jsx - About 2 hrs to fix

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

      render(
        props,
        { name, color, radius, latitude, longitude, houses, loading, createAreaError, deleteAreaError, getAreaError }
      ) {
        return (
    Severity: Minor
    Found in front/src/routes/map/NewArea.jsx - About 1 hr to fix

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

        getHouses = async () => {
          try {
            const houses = await this.props.httpClient.get('/api/v1/house');
            this.setState({
              houses
      Severity: Major
      Found in front/src/routes/map/NewArea.jsx and 4 other locations - About 2 hrs to fix
      front/src/routes/integration/all/enedis-gateway/UsagePoints.jsx on lines 254..261
      front/src/routes/map/index.jsx on lines 9..20
      front/src/routes/map/index.jsx on lines 21..30
      front/src/routes/map/index.jsx on lines 31..40

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

      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

                          {!props.creationMode && (
                            <div class="col">
                              <button onClick={props.deleteArea} class="btn btn-danger btn-block">
                                <Text id="newArea.deleteButton" />
                              </button>
      Severity: Major
      Found in front/src/routes/map/NewArea.jsx and 1 other location - About 1 hr to fix
      front/src/components/device/UpdateDeviceFeature.jsx on lines 186..192

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

      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

        render(
          props,
          { name, color, radius, latitude, longitude, houses, loading, createAreaError, deleteAreaError, getAreaError }
        ) {
          return (
      Severity: Minor
      Found in front/src/routes/map/NewArea.jsx and 1 other location - About 55 mins to fix
      front/src/routes/dashboard/index.js on lines 249..299

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

      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

                            <button onClick={props.createArea} class="btn btn-primary btn-block">
                              {props.creationMode && <Text id="newArea.createButton" />}
                              {!props.creationMode && <Text id="newArea.updateButton" />}
                            </button>
      Severity: Minor
      Found in front/src/routes/map/NewArea.jsx and 1 other location - About 45 mins to fix
      front/src/routes/map/NewArea.jsx on lines 25..28

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

      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

                        <h3>
                          {props.creationMode && <Text id="newArea.cardTitleCreate" />}
                          {!props.creationMode && <Text id="newArea.cardTitleEdit" />}
                        </h3>
      Severity: Minor
      Found in front/src/routes/map/NewArea.jsx and 1 other location - About 45 mins to fix
      front/src/routes/map/NewArea.jsx on lines 113..116

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

      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