GladysProject/Gladys

View on GitHub

Showing 2,674 of 2,674 total issues

Function setTabletMode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function setTabletMode(userId, sessionId, tabletMode, houseSelector) {
  const session = await db.Session.findOne({
    attributes: ['id'],
    where: {
      id: sessionId,
Severity: Minor
Found in server/lib/session/session.setTabletMode.js - About 1 hr to fix

    Function setValue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function setValue(broadlinkDevice, gladysDevice, deviceFeature, value) {
      const { type } = deviceFeature;
      const valueStr = value.toString();
    
      // Check for valued code
    Severity: Minor
    Found in server/services/broadlink/lib/commands/features/broadlink.remote.js - About 1 hr to fix

      Function mapUnit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function mapUnit(deviceUnit, featureUnit) {
        switch (deviceUnit) {
          case '%':
            return DEVICE_FEATURE_UNITS.PERCENT;
          case 'hPa':
      Severity: Minor
      Found in server/services/zigbee2mqtt/utils/features/mapUnit.js - About 1 hr to fix

        Function SceneManager has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SceneManager = function SceneManager(
          stateManager,
          event,
          device,
          message,
        Severity: Minor
        Found in server/lib/scene/index.js - About 1 hr to fix

          Function waitForRestoreToFinish has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async waitForRestoreToFinish(state) {
                try {
                  const restoreStatus = await state.httpClient.get('/api/v1/gateway/backup/restore/status');
                  if (restoreStatus.restore_in_progress) {
                    setTimeout(() => {
          Severity: Minor
          Found in front/src/actions/gateway.js - About 1 hr to fix

            Function connectBridge has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async connectBridge(state, bridge) {
                store.setState({
                  philipsHueCreateDeviceStatus: RequestStatus.Getting
                });
                try {
            Severity: Minor
            Found in front/src/routes/integration/all/philips-hue/setup-page/actions.js - About 1 hr to fix

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

                render({}, { numberOfHoursBeforeStateIsOutdated }) {
                  return (
                    <div class="card">
                      <h4 class="card-header">
                        <Text id="systemSettings.numberOfHoursBeforeStateIsOutdated" />

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

                  render(props, {}) {
                    let temperature_min = this.props.box.temperature_min;
                    let temperature_max = this.props.box.temperature_max;
                
                    const unit = this.props.user.temperature_unit_preference;

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

                      async search(state, e) {
                        store.setState({
                          lanManagerDeviceSearch: e.target.value
                        });
                        await actions.getLANManagerDevices(store.getState(), 20, 0);
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 56..61
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 62..67
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 77..82
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 104..109
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 110..115

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

                  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

                      async changeOrderDir(state, e) {
                        store.setState({
                          getLANManagerDeviceOrderDir: e.target.value
                        });
                        await actions.getLANManagerDevices(store.getState(), 20, 0);
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 56..61
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 62..67
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 71..76
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 104..109
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 110..115

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

                  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

                      async search(state, e) {
                        store.setState({
                          zigbee2mqttSearch: e.target.value
                        });
                        await actions.getZigbee2mqttDevices(store.getState(), 20, 0);
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 56..61
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 62..67
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 71..76
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 77..82
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 110..115

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

                  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

                      async search(state, e) {
                        store.setState({
                          bluetoothDeviceSearch: e.target.value
                        });
                        await actions.getBluetoothDevices(store.getState(), 20, 0);
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 62..67
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 71..76
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 77..82
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 104..109
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 110..115

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

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

                  module.exports = {
                    BRIDGE_MODEL,
                    BRIDGE_EXTERNAL_ID_BASE,
                    HUE_APP_NAME,
                    HUE_DEVICE_NAME,
                  Severity: Major
                  Found in server/services/philips-hue/lib/utils/consts.js and 4 other locations - About 1 hr to fix
                  server/services/ewelink/lib/utils/constants.js on lines 16..26
                  server/utils/colors.js on lines 184..194
                  server/utils/device.js on lines 228..238
                  server/utils/httpErrors.js on lines 81..91

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

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

                  module.exports = {
                    HttpError,
                    Error400,
                    Error401,
                    Error403,
                  Severity: Major
                  Found in server/utils/httpErrors.js and 4 other locations - About 1 hr to fix
                  server/services/ewelink/lib/utils/constants.js on lines 16..26
                  server/services/philips-hue/lib/utils/consts.js on lines 12..22
                  server/utils/colors.js on lines 184..194
                  server/utils/device.js on lines 228..238

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

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

                  module.exports = {
                    getDeviceParam,
                    setDeviceParam,
                    getDeviceFeature,
                    setDeviceFeature,
                  Severity: Major
                  Found in server/utils/device.js and 4 other locations - About 1 hr to fix
                  server/services/ewelink/lib/utils/constants.js on lines 16..26
                  server/services/philips-hue/lib/utils/consts.js on lines 12..22
                  server/utils/colors.js on lines 184..194
                  server/utils/httpErrors.js on lines 81..91

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

                  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

                      async changeOrderDir(state, e) {
                        store.setState({
                          getZigbee2mqttOrderDir: e.target.value
                        });
                        await actions.getZigbee2mqttDevices(store.getState(), 20, 0);
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 56..61
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 62..67
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 71..76
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 77..82
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 104..109

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

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

                  module.exports = {
                    intToRgb,
                    rgbToInt,
                    intToHex,
                    hexToInt,
                  Severity: Major
                  Found in server/utils/colors.js and 4 other locations - About 1 hr to fix
                  server/services/ewelink/lib/utils/constants.js on lines 16..26
                  server/services/philips-hue/lib/utils/consts.js on lines 12..22
                  server/utils/device.js on lines 228..238
                  server/utils/httpErrors.js on lines 81..91

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

                  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

                      async changeOrderDir(state, e) {
                        store.setState({
                          getBluetoothDeviceOrderDir: e.target.value
                        });
                        await actions.getBluetoothDevices(store.getState(), 20, 0);
                  front/src/routes/integration/all/bluetooth/device-page/actions.js on lines 56..61
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 71..76
                  front/src/routes/integration/all/lan-manager/device-page/actions.js on lines 77..82
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 104..109
                  front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js on lines 110..115

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

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

                  module.exports = {
                    EWELINK_EMAIL_KEY,
                    EWELINK_PASSWORD_KEY,
                    EWELINK_REGION_KEY,
                    EWELINK_REGIONS,
                  Severity: Major
                  Found in server/services/ewelink/lib/utils/constants.js and 4 other locations - About 1 hr to fix
                  server/services/philips-hue/lib/utils/consts.js on lines 12..22
                  server/utils/colors.js on lines 184..194
                  server/utils/device.js on lines 228..238
                  server/utils/httpErrors.js on lines 81..91

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

                  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

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

                            if (feature.unit === DEVICE_FEATURE_UNITS.KELVIN) {
                              currentTemp -= 273.15;
                            } else if (feature.unit === DEVICE_FEATURE_UNITS.FAHRENHEIT) {
                              currentTemp = fahrenheitToCelsius(currentTemp);
                            }
                  Severity: Major
                  Found in server/services/homekit/lib/buildService.js and 1 other location - About 1 hr to fix
                  server/services/homekit/lib/sendState.js on lines 73..77

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

                  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