GladysProject/Gladys

View on GitHub

Showing 1,936 of 2,690 total issues

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

                <Link href={props.previousPage}>
                  <button class="btn btn-secondary mr-2">
                    <Text id="global.backButton" />
                  </button>
                </Link>
Severity: Major
Found in front/src/components/device/UpdateDevice.jsx and 2 other locations - About 55 mins to fix
front/src/components/boxs/camera/Camera.jsx on lines 292..296
front/src/components/device/UpdateDevice.jsx on lines 13..17

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.addFeature}
                    class="btn btn-outline-success ml-2"
                    disabled={!props.selectedFeature}
                  >
front/src/components/device/UpdateDevice.jsx on lines 72..78

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.addFeature}
                    class="btn btn-outline-success ml-2"
                    disabled={!props.selectedFeature}
                  >
Severity: Minor
Found in front/src/components/device/UpdateDevice.jsx and 1 other location - About 55 mins to fix
front/src/routes/integration/all/mqtt/device-page/setup/FeatureTab.jsx on lines 70..76

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

    if (isNullOrUndefined(get(this.props, 'action.stop_scene_if_event_found'))) {
      this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'stop_scene_if_event_found', false);
    }
front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx on lines 111..113

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 class="btn btn-sm btn-outline-success" onClick={this.test} disabled={!codeExist || disabled}>
              <Text id="integration.broadlink.setup.testLabel" />
            </button>
front/src/routes/integration/all/broadlink/remote-page/edition/RemoteFeatureEdition.jsx on lines 112..114

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

                    <label class="custom-control-label" htmlFor={`tags-filter-${tag.name}`}>
                      {tag.name.length > MAX_LENGTH_TAG ? `${tag.name.substring(0, MAX_LENGTH_TAG - 3)}...` : tag.name}
                    </label>
Severity: Minor
Found in front/src/routes/scene/SceneTagFilter.jsx and 1 other location - About 55 mins to fix
front/src/routes/scene/SceneCard.jsx on lines 60..64

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

      this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
        type: WEBSOCKET_MESSAGE_TYPES.ZIGBEE2MQTT.DISCOVER,
        payload: this.getDiscoveredDevices(),
      });
Severity: Minor
Found in server/services/zigbee2mqtt/lib/handleMqttMessage.js and 1 other location - About 55 mins to fix
server/services/lan-manager/lib/lan-manager.scan.js on lines 22..25

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

          <a class="dropdown-item" onClick={props.deleteScene}>
            <Text id="editScene.deleteButton" /> <i class="fe fe-trash" />
          </a>
Severity: Minor
Found in front/src/routes/scene/edit-scene/SceneActionsDropdown.jsx and 1 other location - About 55 mins to fix
front/src/routes/scene/edit-scene/SceneActionsDropdown.jsx on lines 50..52

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 class="btn btn-sm btn-outline-danger" onClick={this.deleteValue} disabled={!codeExist || disabled}>
              <Text id="integration.broadlink.setup.deleteLabel" />
            </button>
front/src/routes/integration/all/broadlink/remote-page/edition/RemoteFeatureEdition.jsx on lines 108..110

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

  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/components/boxs/chart/Chart.jsx on lines 267..488

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

    this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
      type: WEBSOCKET_MESSAGE_TYPES.LAN.SCANNING,
      payload: this.getStatus(),
    });
Severity: Minor
Found in server/services/lan-manager/lib/lan-manager.scan.js and 1 other location - About 55 mins to fix
server/services/zigbee2mqtt/lib/handleMqttMessage.js on lines 36..39

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

          <a class="dropdown-item" onClick={props.duplicateScene}>
            <Text id="editScene.duplicateButton" /> <i className="fe fe-copy" />
          </a>
Severity: Minor
Found in front/src/routes/scene/edit-scene/SceneActionsDropdown.jsx and 1 other location - About 55 mins to fix
front/src/routes/scene/edit-scene/SceneActionsDropdown.jsx on lines 54..56

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

                      <span class="badge badge-secondary mr-1">
                        {tag.name.length > MAX_LENGTH_TAG
                          ? `${tag.name.substring(0, MAX_LENGTH_TAG - 3)}...`
                          : tag.name}
                      </span>
Severity: Minor
Found in front/src/routes/scene/SceneCard.jsx and 1 other location - About 55 mins to fix
front/src/routes/scene/SceneTagFilter.jsx on lines 129..131

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

  render(
    props,
    {
      initialized,
      loading,
Severity: Minor
Found in front/src/components/boxs/chart/Chart.jsx and 1 other location - About 55 mins to fix
front/src/routes/map/NewArea.jsx on lines 227..260

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

    if (isNullOrUndefined(get(this.props, 'action.stop_scene_if_event_not_found'))) {
      this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'stop_scene_if_event_not_found', true);
    }
front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx on lines 108..110

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 25 locations. Consider refactoring.
Open

    battery: {
      feature: {
        category: DEVICE_FEATURE_CATEGORIES.BATTERY,
        type: DEVICE_FEATURE_TYPES.SENSOR.INTEGER,
        unit: DEVICE_FEATURE_UNITS.PERCENT,
Severity: Major
Found in server/services/zigbee2mqtt/exposes/numericType.js and 24 other locations - About 55 mins to fix
server/services/zigbee2mqtt/exposes/numericType.js on lines 36..44
server/services/zigbee2mqtt/exposes/numericType.js on lines 70..78
server/services/zigbee2mqtt/exposes/numericType.js on lines 87..95
server/services/zigbee2mqtt/exposes/numericType.js on lines 96..104
server/services/zigbee2mqtt/exposes/numericType.js on lines 143..151
server/services/zigbee2mqtt/exposes/numericType.js on lines 152..160
server/services/zigbee2mqtt/exposes/numericType.js on lines 282..290
server/services/zigbee2mqtt/exposes/numericType.js on lines 291..299
server/services/zigbee2mqtt/exposes/numericType.js on lines 300..308
server/services/zigbee2mqtt/exposes/numericType.js on lines 309..317
server/services/zigbee2mqtt/exposes/numericType.js on lines 318..326
server/services/zigbee2mqtt/exposes/numericType.js on lines 327..335
server/services/zigbee2mqtt/exposes/numericType.js on lines 336..344
server/services/zigbee2mqtt/exposes/numericType.js on lines 345..353
server/services/zigbee2mqtt/exposes/numericType.js on lines 354..362
server/services/zigbee2mqtt/exposes/numericType.js on lines 363..371
server/services/zigbee2mqtt/exposes/numericType.js on lines 372..380
server/services/zigbee2mqtt/exposes/numericType.js on lines 500..508
server/services/zigbee2mqtt/exposes/numericType.js on lines 509..517
server/services/zigbee2mqtt/exposes/numericType.js on lines 518..526
server/services/zigbee2mqtt/exposes/numericType.js on lines 527..535
server/services/zigbee2mqtt/exposes/numericType.js on lines 737..745
server/services/zigbee2mqtt/exposes/numericType.js on lines 746..754
server/services/zigbee2mqtt/exposes/numericType.js on lines 755..763

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

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 11 locations. Consider refactoring.
Open

  handleNetworkStatusChange = e => {
    this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'ecowatt_network_status', e.target.value);
  };
front/src/routes/integration/all/ewelink/EweLinkDeviceBox.jsx on lines 11..13
front/src/routes/integration/all/ewelink/EweLinkDeviceBox.jsx on lines 15..17
front/src/routes/scene/edit-scene/actions/BlinkLightParams.jsx on lines 42..44
front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx on lines 56..58
front/src/routes/scene/edit-scene/actions/DelayActionParams.jsx on lines 10..12
front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 9..11
front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 13..20
front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 22..29
front/src/routes/scene/edit-scene/actions/HttpRequest.jsx on lines 100..102
front/src/routes/scene/edit-scene/actions/SendMqttMessage.jsx on lines 13..15

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

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 25 locations. Consider refactoring.
Open

    EASF08: {
      feature: {
        category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR,
        type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX,
        unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR,
Severity: Major
Found in server/services/zigbee2mqtt/exposes/numericType.js and 24 other locations - About 55 mins to fix
server/services/zigbee2mqtt/exposes/numericType.js on lines 27..35
server/services/zigbee2mqtt/exposes/numericType.js on lines 36..44
server/services/zigbee2mqtt/exposes/numericType.js on lines 70..78
server/services/zigbee2mqtt/exposes/numericType.js on lines 87..95
server/services/zigbee2mqtt/exposes/numericType.js on lines 96..104
server/services/zigbee2mqtt/exposes/numericType.js on lines 143..151
server/services/zigbee2mqtt/exposes/numericType.js on lines 152..160
server/services/zigbee2mqtt/exposes/numericType.js on lines 282..290
server/services/zigbee2mqtt/exposes/numericType.js on lines 291..299
server/services/zigbee2mqtt/exposes/numericType.js on lines 300..308
server/services/zigbee2mqtt/exposes/numericType.js on lines 309..317
server/services/zigbee2mqtt/exposes/numericType.js on lines 318..326
server/services/zigbee2mqtt/exposes/numericType.js on lines 327..335
server/services/zigbee2mqtt/exposes/numericType.js on lines 336..344
server/services/zigbee2mqtt/exposes/numericType.js on lines 345..353
server/services/zigbee2mqtt/exposes/numericType.js on lines 363..371
server/services/zigbee2mqtt/exposes/numericType.js on lines 372..380
server/services/zigbee2mqtt/exposes/numericType.js on lines 500..508
server/services/zigbee2mqtt/exposes/numericType.js on lines 509..517
server/services/zigbee2mqtt/exposes/numericType.js on lines 518..526
server/services/zigbee2mqtt/exposes/numericType.js on lines 527..535
server/services/zigbee2mqtt/exposes/numericType.js on lines 737..745
server/services/zigbee2mqtt/exposes/numericType.js on lines 746..754
server/services/zigbee2mqtt/exposes/numericType.js on lines 755..763

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

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 25 locations. Consider refactoring.
Open

    soil_moisture: {
      feature: {
        category: DEVICE_FEATURE_CATEGORIES.SOIL_MOISTURE_SENSOR,
        type: DEVICE_FEATURE_TYPES.SENSOR.DECIMAL,
        unit: DEVICE_FEATURE_UNITS.PERCENT,
Severity: Major
Found in server/services/zigbee2mqtt/exposes/numericType.js and 24 other locations - About 55 mins to fix
server/services/zigbee2mqtt/exposes/numericType.js on lines 27..35
server/services/zigbee2mqtt/exposes/numericType.js on lines 36..44
server/services/zigbee2mqtt/exposes/numericType.js on lines 70..78
server/services/zigbee2mqtt/exposes/numericType.js on lines 87..95
server/services/zigbee2mqtt/exposes/numericType.js on lines 96..104
server/services/zigbee2mqtt/exposes/numericType.js on lines 143..151
server/services/zigbee2mqtt/exposes/numericType.js on lines 152..160
server/services/zigbee2mqtt/exposes/numericType.js on lines 282..290
server/services/zigbee2mqtt/exposes/numericType.js on lines 291..299
server/services/zigbee2mqtt/exposes/numericType.js on lines 300..308
server/services/zigbee2mqtt/exposes/numericType.js on lines 309..317
server/services/zigbee2mqtt/exposes/numericType.js on lines 318..326
server/services/zigbee2mqtt/exposes/numericType.js on lines 327..335
server/services/zigbee2mqtt/exposes/numericType.js on lines 336..344
server/services/zigbee2mqtt/exposes/numericType.js on lines 345..353
server/services/zigbee2mqtt/exposes/numericType.js on lines 354..362
server/services/zigbee2mqtt/exposes/numericType.js on lines 363..371
server/services/zigbee2mqtt/exposes/numericType.js on lines 372..380
server/services/zigbee2mqtt/exposes/numericType.js on lines 500..508
server/services/zigbee2mqtt/exposes/numericType.js on lines 509..517
server/services/zigbee2mqtt/exposes/numericType.js on lines 518..526
server/services/zigbee2mqtt/exposes/numericType.js on lines 527..535
server/services/zigbee2mqtt/exposes/numericType.js on lines 746..754
server/services/zigbee2mqtt/exposes/numericType.js on lines 755..763

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

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 13 locations. Consider refactoring.
Open

                {props.forgotPasswordStatus === ForgotPasswordStatus.UserNotFound && (
                  <div class="alert alert-danger" role="alert">
                    <Text id="forgotPassword.userNotFound" />
                  </div>
                )}
Severity: Major
Found in front/src/routes/forgot-password/ForgotPasswordPage.jsx and 12 other locations - About 55 mins to fix
front/src/components/gateway/GatewayLoginForm.jsx on lines 20..24
front/src/components/gateway/GatewayLoginForm.jsx on lines 25..29
front/src/components/gateway/GatewayLoginForm.jsx on lines 38..42
front/src/components/gateway/GatewayLoginForm.jsx on lines 43..47
front/src/routes/forgot-password/ForgotPasswordPage.jsx on lines 32..36
front/src/routes/forgot-password/ForgotPasswordPage.jsx on lines 38..42
front/src/routes/forgot-password/ForgotPasswordPage.jsx on lines 50..54
front/src/routes/forgot-password/ForgotPasswordPage.jsx on lines 56..60
front/src/routes/reset-password/ResetPasswordForm.jsx on lines 22..26
front/src/routes/reset-password/ResetPasswordForm.jsx on lines 28..32
front/src/routes/reset-password/ResetPasswordForm.jsx on lines 34..38
front/src/routes/reset-password/ResetPasswordForm.jsx on lines 40..44

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

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

Severity
Category
Status
Source
Language