GladysProject/Gladys

View on GitHub

Showing 1,936 of 2,690 total issues

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

  async function togglePermitJoin(req, res) {
    logger.debug('Toggle permit_join');
    await zigbee2mqttManager.setPermitJoin();
    res.json({
      success: true,
Severity: Major
Found in server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js and 6 other locations - About 55 mins to fix
server/services/node-red/api/node-red.controller.js on lines 21..27
server/services/node-red/api/node-red.controller.js on lines 34..40
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 67..73
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 80..86
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 93..99
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 106..112

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

  componentDidMount() {
    this.getDevice();
    this.props.session.dispatcher.addListener(
      WEBSOCKET_MESSAGE_TYPES.DEVICE.NEW_STATE,
      this.updateDeviceStateWebsocket
Severity: Major
Found in front/src/components/boxs/music/MusicBox.jsx and 6 other locations - About 55 mins to fix
front/src/components/boxs/chart/Chart.jsx on lines 241..247
front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 63..66
front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
front/src/routes/integration/all/mqtt/debug-page/Debug.jsx on lines 43..49
front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 46..52
front/src/routes/locked/index.js on lines 146..149

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

            <button onClick={props.cancelDeleteCurrentDashboard} className="btn btn-outline-secondary btn-sm ml-2">
              <Text id="dashboard.editDashboardCancelButton" /> <i class="fe fe-slash" />
            </button>
Severity: Major
Found in front/src/routes/dashboard/edit-dashboard/EditActions.jsx and 5 other locations - About 55 mins to fix
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 9..11
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 12..14
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 15..17
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 24..26
front/src/routes/settings/settings-house/HousePage.jsx on lines 23..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 6 locations. Consider refactoring.
Open

            <button onClick={props.saveDashboard} className="btn btn-outline-primary btn-sm ml-2">
              <Text id="dashboard.editDashboardSaveButton" /> <i class="fe fe-check" />
            </button>
Severity: Major
Found in front/src/routes/dashboard/edit-dashboard/EditActions.jsx and 5 other locations - About 55 mins to fix
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 9..11
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 12..14
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 24..26
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 27..29
front/src/routes/settings/settings-house/HousePage.jsx on lines 23..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 7 locations. Consider refactoring.
Open

  async function installMqttContainer(req, res) {
    logger.debug('Install MQTT container');
    await zigbee2mqttManager.installMqttContainer();
    res.json({
      success: true,
Severity: Major
Found in server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js and 6 other locations - About 55 mins to fix
server/services/node-red/api/node-red.controller.js on lines 21..27
server/services/node-red/api/node-red.controller.js on lines 34..40
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 67..73
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 93..99
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 106..112
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 119..125

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

  componentDidMount() {
    this.refreshData();
    this.props.session.dispatcher.addListener(WEBSOCKET_MESSAGE_TYPES.DEVICE.NEW_STATE, this.updateRoomHumidity);
  }
Severity: Major
Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 6 other locations - About 55 mins to fix
front/src/components/boxs/chart/Chart.jsx on lines 241..247
front/src/components/boxs/music/MusicBox.jsx on lines 89..95
front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
front/src/routes/integration/all/mqtt/debug-page/Debug.jsx on lines 43..49
front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 46..52
front/src/routes/locked/index.js on lines 146..149

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

  async function getBySelector(req, res) {
    const scene = await gladys.scene.getBySelector(req.params.scene_selector);
    res.json(scene);
  }
Severity: Major
Found in server/api/controllers/scene.controller.js and 6 other locations - About 55 mins to fix
server/api/controllers/dashboard.controller.js on lines 37..40
server/api/controllers/house.controller.js on lines 63..66
server/api/controllers/house.controller.js on lines 125..128
server/api/controllers/house.controller.js on lines 145..148
server/api/controllers/house.controller.js on lines 165..168
server/api/controllers/user.controller.js on lines 78..81

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

  async function connect(req, res) {
    logger.debug('Entering connect step');
    await zigbee2mqttManager.init();
    res.json({
      success: true,
Severity: Major
Found in server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js and 6 other locations - About 55 mins to fix
server/services/node-red/api/node-red.controller.js on lines 21..27
server/services/node-red/api/node-red.controller.js on lines 34..40
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 80..86
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 93..99
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 106..112
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 119..125

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

  async function disconnect(req, res) {
    logger.debug('Entering disconnect step');
    await zigbee2mqttManager.disconnect();
    res.json({
      success: true,
Severity: Major
Found in server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js and 6 other locations - About 55 mins to fix
server/services/node-red/api/node-red.controller.js on lines 21..27
server/services/node-red/api/node-red.controller.js on lines 34..40
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 67..73
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 80..86
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 93..99
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 119..125

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

        <button onClick={props.addHouse} class="btn btn-outline-primary ml-2">
          <Text id="housesSettings.newButton" /> <i class="fe fe-plus" />
        </button>
Severity: Major
Found in front/src/routes/settings/settings-house/HousePage.jsx and 5 other locations - About 55 mins to fix
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 9..11
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 12..14
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 15..17
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 24..26
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 27..29

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

  async componentWillMount() {
    this.getDiscoveredDevices();
    this.props.session.dispatcher.addListener(
      WEBSOCKET_MESSAGE_TYPES.ZWAVEJS_UI.SCAN_COMPLETED,
      this.getDiscoveredDevices
front/src/components/boxs/chart/Chart.jsx on lines 241..247
front/src/components/boxs/music/MusicBox.jsx on lines 89..95
front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 63..66
front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
front/src/routes/integration/all/mqtt/debug-page/Debug.jsx on lines 43..49
front/src/routes/locked/index.js on lines 146..149

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

  componentWillMount() {
    this.setDebugMode();
    this.props.session.dispatcher.addListener(
      WEBSOCKET_MESSAGE_TYPES.MQTT.DEBUG_NEW_MQTT_MESSAGE,
      this.displayNewMqttMessage
Severity: Major
Found in front/src/routes/integration/all/mqtt/debug-page/Debug.jsx and 6 other locations - About 55 mins to fix
front/src/components/boxs/chart/Chart.jsx on lines 241..247
front/src/components/boxs/music/MusicBox.jsx on lines 89..95
front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 63..66
front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 46..52
front/src/routes/locked/index.js on lines 146..149

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

  async function installNodeRedContainer(req, res) {
    logger.debug('Install Node-RED container');
    await nodeRedManager.installContainer();
    res.json({
      success: true,
Severity: Major
Found in server/services/node-red/api/node-red.controller.js and 6 other locations - About 55 mins to fix
server/services/node-red/api/node-red.controller.js on lines 21..27
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 67..73
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 80..86
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 93..99
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 106..112
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 119..125

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

  componentDidMount() {
    this.getData();
    this.props.session.dispatcher.addListener(
      WEBSOCKET_MESSAGE_TYPES.DEVICE.NEW_STATE,
      this.updateDeviceStateWebsocket
Severity: Major
Found in front/src/components/boxs/chart/Chart.jsx and 6 other locations - About 55 mins to fix
front/src/components/boxs/music/MusicBox.jsx on lines 89..95
front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 63..66
front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
front/src/routes/integration/all/mqtt/debug-page/Debug.jsx on lines 43..49
front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 46..52
front/src/routes/locked/index.js on lines 146..149

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

  async function disarm(req, res) {
    const house = await gladys.house.disarm(req.params.house_selector);
    res.json(house);
  }
Severity: Major
Found in server/api/controllers/house.controller.js and 6 other locations - About 55 mins to fix
server/api/controllers/dashboard.controller.js on lines 37..40
server/api/controllers/house.controller.js on lines 63..66
server/api/controllers/house.controller.js on lines 125..128
server/api/controllers/house.controller.js on lines 165..168
server/api/controllers/scene.controller.js on lines 54..57
server/api/controllers/user.controller.js on lines 78..81

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

  componentDidMount() {
    this.init();
    this.props.session.dispatcher.addListener(WEBSOCKET_MESSAGE_TYPES.ALARM.DISARMED, this.disarmed);
  }
Severity: Major
Found in front/src/routes/locked/index.js and 6 other locations - About 55 mins to fix
front/src/components/boxs/chart/Chart.jsx on lines 241..247
front/src/components/boxs/music/MusicBox.jsx on lines 89..95
front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 63..66
front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
front/src/routes/integration/all/mqtt/debug-page/Debug.jsx on lines 43..49
front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 46..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 7 locations. Consider refactoring.
Open

  async function connect(req, res) {
    logger.debug('Entering connect step');
    await nodeRedManager.init();
    res.json({
      success: true,
Severity: Major
Found in server/services/node-red/api/node-red.controller.js and 6 other locations - About 55 mins to fix
server/services/node-red/api/node-red.controller.js on lines 34..40
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 67..73
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 80..86
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 93..99
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 106..112
server/services/zigbee2mqtt/api/zigbee2mqtt.controller.js on lines 119..125

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

            <button onClick={props.deleteCurrentDashboard} className="btn btn-outline-danger btn-sm ml-2">
              <Text id="dashboard.editDashboardDeleteButton" /> <i class="fe fe-trash" />
            </button>
Severity: Major
Found in front/src/routes/dashboard/edit-dashboard/EditActions.jsx and 5 other locations - About 55 mins to fix
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 9..11
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 12..14
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 15..17
front/src/routes/dashboard/edit-dashboard/EditActions.jsx on lines 27..29
front/src/routes/settings/settings-house/HousePage.jsx on lines 23..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 7 locations. Consider refactoring.
Open

  async function getBySelector(req, res) {
    const house = await gladys.house.getBySelector(req.params.house_selector);
    res.json(house);
  }
Severity: Major
Found in server/api/controllers/house.controller.js and 6 other locations - About 55 mins to fix
server/api/controllers/dashboard.controller.js on lines 37..40
server/api/controllers/house.controller.js on lines 125..128
server/api/controllers/house.controller.js on lines 145..148
server/api/controllers/house.controller.js on lines 165..168
server/api/controllers/scene.controller.js on lines 54..57
server/api/controllers/user.controller.js on lines 78..81

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

  async function getUserBySelector(req, res) {
    const user = await gladys.user.getBySelector(req.params.user_selector);
    res.json(user);
  }
Severity: Major
Found in server/api/controllers/user.controller.js and 6 other locations - About 55 mins to fix
server/api/controllers/dashboard.controller.js on lines 37..40
server/api/controllers/house.controller.js on lines 63..66
server/api/controllers/house.controller.js on lines 125..128
server/api/controllers/house.controller.js on lines 145..148
server/api/controllers/house.controller.js on lines 165..168
server/api/controllers/scene.controller.js on lines 54..57

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

Severity
Category
Status
Source
Language