GladysProject/Gladys

View on GitHub

Showing 1,468 of 2,032 total issues

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

Severity: Minor
Found in front/src/config/demo.js and 1 other location - About 40 mins to fix
front/src/config/demo.js on lines 514..524

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

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

                        <input
                          id={`topic_${deviceIndex}`}
                          type="text"
                          value={device.external_id}
                          class="form-control"
front/src/routes/integration/all/ewelink/EweLinkDeviceBox.jsx on lines 129..135

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

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

                  <input
                    id={`model_${deviceIndex}`}
                    type="text"
                    value={device.model}
                    class="form-control"
Severity: Minor
Found in front/src/routes/integration/all/ewelink/EweLinkDeviceBox.jsx and 1 other location - About 40 mins to fix
front/src/routes/integration/all/zigbee2mqtt/discover-page/DiscoveredBox.jsx on lines 122..128

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

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 (question.answers) {
      question.answers.forEach((text) => {
        this.nlpManager.addAnswer(question.language, question.label, text);
      });
    }
Severity: Minor
Found in server/lib/brain/brain.train.js and 1 other location - About 40 mins to fix
server/lib/brain/brain.train.js on lines 52..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 49.

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 db.DeviceFeature.update(
    {
      last_value: newValue,
      last_value_changed: now,
    },
Severity: Minor
Found in server/lib/device/device.saveState.js and 1 other location - About 40 mins to fix
server/lib/device/device.saveHistoricalState.js on lines 54..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 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                props.gatewayUsersKeys.map((user, userIndex) => (
                  <GatewayUserRow user={user} userIndex={userIndex} switchUserKey={props.switchUserKey} />
                ))}
Severity: Minor
Found in front/src/routes/settings/settings-gateway/GatewayUsersList.jsx and 1 other location - About 40 mins to fix
front/src/routes/settings/settings-gateway-users/UserList.js on lines 41..43

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

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 db.DeviceFeature.update(
      {
        last_value: newValue,
        last_value_changed: newValueCreatedAtDate,
      },
Severity: Minor
Found in server/lib/device/device.saveHistoricalState.js and 1 other location - About 40 mins to fix
server/lib/device/device.saveState.js on lines 31..41

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

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

const User = function User(session, stateManager, variable) {
  this.session = session;
  this.stateManager = stateManager;
  this.variable = variable;
};
Severity: Minor
Found in server/lib/user/index.js and 1 other location - About 40 mins to fix
server/services/rtsp-camera/lib/index.js on lines 12..16

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

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

const RtspCameraHandler = function RtspCameraHandler(gladys, ffmpeg, serviceId) {
  this.gladys = gladys;
  this.ffmpeg = ffmpeg;
  this.serviceId = serviceId;
};
Severity: Minor
Found in server/services/rtsp-camera/lib/index.js and 1 other location - About 40 mins to fix
server/lib/user/index.js on lines 16..20

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

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

  brainConfig.answers.forEach((answer) => {
    answer.answers.forEach((text) => {
      this.nlpManager.addAnswer(answer.language, answer.label, text);
    });
  });
Severity: Minor
Found in server/lib/brain/brain.train.js and 1 other location - About 40 mins to fix
server/lib/brain/brain.train.js on lines 19..23

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            {props.users.map((user, index) => (
              <UserRow user={user} index={index} revokeUser={props.revokeUser} />
            ))}
Severity: Minor
Found in front/src/routes/settings/settings-gateway-users/UserList.js and 1 other location - About 40 mins to fix
front/src/routes/settings/settings-gateway/GatewayUsersList.jsx on lines 44..46

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SISMIC_SENSOR,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_SENSOR_MULTILEVEL],
    INDEXES: [INDEXES.INDEX_SENSOR_SISMIC_INTENSITY],
    TYPE: DEVICE_FEATURE_TYPES.SENSOR.DECIMAL,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SWITCH,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_METER],
    INDEXES: [INDEXES.INDEX_SWITCH_METER_ENERGY],
    TYPE: DEVICE_FEATURE_TYPES.SWITCH.ENERGY,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SWITCH,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_METER],
    INDEXES: [INDEXES.INDEX_SWITCH_METER_VOLTAGE],
    TYPE: DEVICE_FEATURE_TYPES.SWITCH.VOLTAGE,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.MOTION_SENSOR,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_SENSOR_BINARY],
    INDEXES: [INDEXES.INDEX_SENSOR_BINARY_MOTION],
    TYPE: DEVICE_FEATURE_TYPES.SENSOR.BINARY,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SWITCH,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_METER],
    INDEXES: [INDEXES.INDEX_SWITCH_METER_POWER],
    TYPE: DEVICE_FEATURE_TYPES.SWITCH.POWER,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.LIGHT_SENSOR,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_SENSOR_MULTILEVEL],
    INDEXES: [INDEXES.INDEX_SENSOR_MULTILEVEL_LIGHT],
    TYPE: DEVICE_FEATURE_TYPES.SENSOR.INTEGER,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SWITCH,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_NOTIFICATION],
    INDEXES: [INDEXES.INDEX_NOTIFICATION_BURGLAR],
    TYPE: DEVICE_FEATURE_TYPES.SWITCH.BURGLAR,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 277..282
server/services/zwave/lib/constants.js on lines 284..289

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SWITCH,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_SENSOR_MULTILEVEL],
    INDEXES: [INDEXES.INDEX_SENSOR_MULTILEVEL_POWER],
    TYPE: DEVICE_FEATURE_TYPES.SWITCH.POWER,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 277..282

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

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

  {
    CATEGORY: DEVICE_FEATURE_CATEGORIES.SWITCH,
    COMMAND_CLASSES: [COMMAND_CLASSES.COMMAND_CLASS_SWITCH_MULTILEVEL],
    INDEXES: [INDEXES.INDEX_SWITCH_MULTILEVEL_BINARY],
    TYPE: DEVICE_FEATURE_TYPES.SWITCH.BINARY,
Severity: Major
Found in server/services/zwave/lib/constants.js and 9 other locations - About 40 mins to fix
server/services/zwave/lib/constants.js on lines 214..219
server/services/zwave/lib/constants.js on lines 221..226
server/services/zwave/lib/constants.js on lines 228..233
server/services/zwave/lib/constants.js on lines 241..246
server/services/zwave/lib/constants.js on lines 248..253
server/services/zwave/lib/constants.js on lines 255..260
server/services/zwave/lib/constants.js on lines 262..267
server/services/zwave/lib/constants.js on lines 269..274
server/services/zwave/lib/constants.js on lines 284..289

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

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