GladysProject/Gladys

View on GitHub

Showing 1,932 of 2,674 total issues

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

    {
      id: '99fac564-0844-44f6-866b-2b8dcf0d76eb',
      path: 'https://url-backup',
      size: 1127680,
      created_at: dayjs().subtract(2, 'day'),
Severity: Major
Found in front/src/config/demo.js and 2 other locations - About 1 hr to fix
front/src/config/demo.js on lines 1982..1989
front/src/config/demo.js on lines 1998..2005

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

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

  updateCalendarSharing(state, e) {
    store.setState({
      calendarsSharing: {
        ...state.calendarsSharing,
        [e.target.name]: e.target.checked
front/src/routes/integration/all/caldav/sync-page/actions.js on lines 4..11

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

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

      await Promise.map(deviceInDb.features, async (existingFeature, index) => {
        if (!features.find((newFeature) => newFeature.external_id === existingFeature.external_id)) {
          await existingFeature.destroy({ transaction });
        }
      });
Severity: Major
Found in server/lib/device/device.create.js and 1 other location - About 1 hr to fix
server/lib/device/device.create.js on lines 101..105

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

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

      await Promise.map(deviceInDb.params, async (existingParam) => {
        if (!params.find((newParam) => newParam.name === existingParam.name)) {
          await existingParam.destroy({ transaction });
        }
      });
Severity: Major
Found in server/lib/device/device.create.js and 1 other location - About 1 hr to fix
server/lib/device/device.create.js on lines 94..98

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

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

  scanPresence = async () => {
    try {
      await this.props.httpClient.post('/api/v1/service/bluetooth/presence');
    } catch (e) {
      console.error(e);
front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 12..18

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

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

  updateCalendarsToSync(state, e) {
    store.setState({
      calendarsToSync: {
        ...state.calendarsToSync,
        [e.target.name]: e.target.checked
front/src/routes/integration/all/caldav/share-page/actions.js on lines 4..11

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

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

  scan = async () => {
    try {
      await this.props.httpClient.post('/api/v1/service/zwavejs-ui/discover');
    } catch (e) {
      console.error(e);
front/src/routes/integration/all/bluetooth/settings-page/BluetoothSettingsTab.jsx on lines 44..50

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getHousesOrderDir: e.target.value
      });
      await actions.getHouses(store.getState());
Severity: Major
Found in front/src/actions/house.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getXiaomiDeviceOrderDir: e.target.value
      });
      await actions.getXiaomiDevices(store.getState());
Severity: Major
Found in front/src/routes/integration/all/xiaomi/actions.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async search(state, e) {
      store.setState({
        rtspCameraSearch: e.target.value
      });
      await actions.getRtspCameraDevices(store.getState());
Severity: Major
Found in front/src/routes/integration/all/rtsp-camera/actions.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getTasmotaOrderDir: e.target.value
      });
      await actions.getTasmotaDevices(store.getState());
Severity: Major
Found in front/src/routes/integration/all/tasmota/actions.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async search(state, e) {
      store.setState({
        xiaomiDeviceSearch: e.target.value
      });
      await actions.getXiaomiDevices(store.getState());
Severity: Major
Found in front/src/routes/integration/all/xiaomi/actions.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getScenesOrderDir: e.target.value
      });
      await actions.getScenes(store.getState());
Severity: Major
Found in front/src/actions/scene.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getZwaveDeviceOrderDir: e.target.value
      });
      await actions.getZWaveDevices(store.getState());
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..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 55.

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

    async search(state, e) {
      store.setState({
        tpLinkDeviceSearch: e.target.value
      });
      await actions.getTpLinkDevices(store.getState());
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getPhilipsHueDeviceOrderDir: e.target.value
      });
      await actions.getPhilipsHueDevices(store.getState());
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async search(state, e) {
      store.setState({
        tasmotaSearch: e.target.value
      });
      await actions.getTasmotaDevices(store.getState());
Severity: Major
Found in front/src/routes/integration/all/tasmota/actions.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async changeOrderDir(state, e) {
      store.setState({
        getBroadlinkDeviceOrderDir: e.target.value
      });
      await actions.getBroadlinkRemotes(store.getState());
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async search(state, e) {
      store.setState({
        broadlinkDeviceSearch: e.target.value
      });
      await actions.getBroadlinkRemotes(store.getState());
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 197..202
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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

    async search(state, e) {
      store.setState({
        eweLinkSearch: e.target.value
      });
      await actions.getEweLinkDevices(store.getState());
Severity: Major
Found in front/src/routes/integration/all/ewelink/actions.js and 21 other locations - About 1 hr to fix
front/src/actions/house.js on lines 43..48
front/src/actions/house.js on lines 49..54
front/src/actions/scene.js on lines 34..39
front/src/actions/scene.js on lines 40..45
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 69..74
front/src/routes/integration/all/broadlink/device-page/actions.js on lines 75..80
front/src/routes/integration/all/ewelink/actions.js on lines 203..208
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 65..70
front/src/routes/integration/all/mqtt/device-page/actions.js on lines 71..76
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 107..112
front/src/routes/integration/all/philips-hue/device-page/actions.js on lines 113..118
front/src/routes/integration/all/rtsp-camera/actions.js on lines 240..245
front/src/routes/integration/all/rtsp-camera/actions.js on lines 246..251
front/src/routes/integration/all/tasmota/actions.js on lines 122..127
front/src/routes/integration/all/tasmota/actions.js on lines 128..133
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 105..110
front/src/routes/integration/all/tp-link/device-page/actions.js on lines 111..116
front/src/routes/integration/all/xiaomi/actions.js on lines 98..103
front/src/routes/integration/all/xiaomi/actions.js on lines 104..109
front/src/routes/integration/all/zwave/node-page/actions.js on lines 71..76
front/src/routes/integration/all/zwave/node-page/actions.js on lines 77..82

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

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