GladysProject/Gladys

View on GitHub

Showing 2,690 of 2,690 total issues

Function refreshNetatmoValues has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function refreshNetatmoValues() {
  logger.debug('Looking for Netatmo devices values...');
  await this.saveStatus({ statusType: STATUS.GET_DEVICES_VALUES, message: null });

  let devicesNetatmo = [];
Severity: Minor
Found in server/services/netatmo/lib/netatmo.pollRefreshingValues.js - About 1 hr to fix

    Function getConfiguration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function getConfiguration() {
      logger.debug('Zigbee2mqtt: loading stored configuration...');
    
      // Load z2m parameters
      const z2mDriverPath = await this.gladys.variable.getValue(CONFIGURATION.Z2M_DRIVER_PATH, this.serviceId);
    Severity: Minor
    Found in server/services/zigbee2mqtt/lib/getConfiguration.js - About 1 hr to fix

      Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function init() {
        if (!(await this.isEnabled())) {
          logger.info('Nodered: is not enabled, skipping...');
          return;
        }
      Severity: Minor
      Found in server/services/node-red/lib/init.js - About 1 hr to fix

        Function createActions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createActions(store) {
          const boxActions = createBoxActions(store);
        
          const actions = {
            async getHumidityInRoom(state, box, x, y) {
        Severity: Minor
        Found in front/src/actions/dashboard/boxes/humidityInRoom.js - About 1 hr to fix

          Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function init() {
            const lights = await db.Device.findAll({
              include: [
                {
                  model: db.DeviceFeature,
          Severity: Minor
          Found in server/lib/device/light/light.init.js - About 1 hr to fix

            Function getUsers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async getUsers(state) {
                  store.setState({
                    usersGetStatus: RequestStatus.Getting
                  });
                  try {
            Severity: Minor
            Found in front/src/actions/gatewayLinkUser.js - About 1 hr to fix

              Function createActions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createActions(store) {
                const boxActions = createBoxActions(store);
              
                const actions = {
                  async getTemperatureInRoom(state, box, x, y) {
              Severity: Minor
              Found in front/src/actions/dashboard/boxes/temperatureInRoom.js - About 1 hr to fix

                Function getDefaultState has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getDefaultState() {
                  const session = config.gatewayMode ? new GatewaySession() : config.demoMode ? new DemoSession() : new Session();
                  const httpClient = config.demoMode
                    ? new DemoHttpClient()
                    : config.gatewayMode
                Severity: Minor
                Found in front/src/utils/getDefaultState.js - About 1 hr to fix

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

                    render(props, {}) {
                      return (
                        <tr>
                          <td class={style.userNameCell}>
                            {props.user.name}
                  Severity: Minor
                  Found in front/src/routes/settings/settings-gateway/GatewayUserRow.jsx - About 1 hr to fix

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

                      render(props, { confirmBackup }) {
                        return (
                          <tr>
                            <td>
                              {dayjs(props.backup.created_at)
                    Severity: Minor
                    Found in front/src/routes/settings/settings-backup/GatewayBackupRow.jsx - About 1 hr to fix

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

                        render(props, { confirmBackup }) {
                          return (
                            <tr>
                              <td>
                                {dayjs(props.backup.created_at)

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

                        class Error401 extends HttpError {
                          constructor(message) {
                            super();
                            this.status = 401;
                            this.code = 'UNAUTHORIZED';
                        Severity: Major
                        Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
                        server/utils/httpErrors.js on lines 9..16
                        server/utils/httpErrors.js on lines 27..34
                        server/utils/httpErrors.js on lines 36..43
                        server/utils/httpErrors.js on lines 45..52
                        server/utils/httpErrors.js on lines 54..61
                        server/utils/httpErrors.js on lines 63..70
                        server/utils/httpErrors.js on lines 72..79

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

                          async function destroy(req, res) {
                            await gladys.house.destroy(req.params.house_selector);
                            res.json({
                              success: true,
                            });
                        Severity: Major
                        Found in server/api/controllers/house.controller.js and 7 other locations - About 1 hr to fix
                        server/api/controllers/area.controller.js on lines 65..70
                        server/api/controllers/calendar.controller.js on lines 78..83
                        server/api/controllers/calendar.controller.js on lines 136..141
                        server/api/controllers/device.controller.js on lines 54..59
                        server/api/controllers/house.controller.js on lines 135..138
                        server/api/controllers/room.controller.js on lines 55..60
                        server/api/controllers/scene.controller.js on lines 64..69

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

                          async function destroy(req, res) {
                            await gladys.calendar.destroy(req.params.calendar_selector);
                            res.json({
                              success: true,
                            });
                        Severity: Major
                        Found in server/api/controllers/calendar.controller.js and 7 other locations - About 1 hr to fix
                        server/api/controllers/area.controller.js on lines 65..70
                        server/api/controllers/calendar.controller.js on lines 136..141
                        server/api/controllers/device.controller.js on lines 54..59
                        server/api/controllers/house.controller.js on lines 92..97
                        server/api/controllers/house.controller.js on lines 135..138
                        server/api/controllers/room.controller.js on lines 55..60
                        server/api/controllers/scene.controller.js on lines 64..69

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

                          async function arm(req, res) {
                            await gladys.house.arm(req.params.house_selector);
                            res.json({ success: true });
                          }
                        Severity: Major
                        Found in server/api/controllers/house.controller.js and 7 other locations - About 1 hr to fix
                        server/api/controllers/area.controller.js on lines 65..70
                        server/api/controllers/calendar.controller.js on lines 78..83
                        server/api/controllers/calendar.controller.js on lines 136..141
                        server/api/controllers/device.controller.js on lines 54..59
                        server/api/controllers/house.controller.js on lines 92..97
                        server/api/controllers/room.controller.js on lines 55..60
                        server/api/controllers/scene.controller.js on lines 64..69

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

                        class Error404 extends HttpError {
                          constructor(message) {
                            super();
                            this.status = 404;
                            this.code = 'NOT_FOUND';
                        Severity: Major
                        Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
                        server/utils/httpErrors.js on lines 9..16
                        server/utils/httpErrors.js on lines 18..25
                        server/utils/httpErrors.js on lines 27..34
                        server/utils/httpErrors.js on lines 45..52
                        server/utils/httpErrors.js on lines 54..61
                        server/utils/httpErrors.js on lines 63..70
                        server/utils/httpErrors.js on lines 72..79

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

                        class Error500 extends HttpError {
                          constructor(error) {
                            super();
                            this.status = 500;
                            this.code = 'SERVER_ERROR';
                        Severity: Major
                        Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
                        server/utils/httpErrors.js on lines 9..16
                        server/utils/httpErrors.js on lines 18..25
                        server/utils/httpErrors.js on lines 27..34
                        server/utils/httpErrors.js on lines 36..43
                        server/utils/httpErrors.js on lines 45..52
                        server/utils/httpErrors.js on lines 54..61
                        server/utils/httpErrors.js on lines 63..70

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

                          async function destroy(req, res) {
                            await gladys.device.destroy(req.params.device_selector);
                            res.json({
                              success: true,
                            });
                        Severity: Major
                        Found in server/api/controllers/device.controller.js and 7 other locations - About 1 hr to fix
                        server/api/controllers/area.controller.js on lines 65..70
                        server/api/controllers/calendar.controller.js on lines 78..83
                        server/api/controllers/calendar.controller.js on lines 136..141
                        server/api/controllers/house.controller.js on lines 92..97
                        server/api/controllers/house.controller.js on lines 135..138
                        server/api/controllers/room.controller.js on lines 55..60
                        server/api/controllers/scene.controller.js on lines 64..69

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

                        class Error400 extends HttpError {
                          constructor(message) {
                            super();
                            this.status = 400;
                            this.code = 'BAD_REQUEST';
                        Severity: Major
                        Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
                        server/utils/httpErrors.js on lines 18..25
                        server/utils/httpErrors.js on lines 27..34
                        server/utils/httpErrors.js on lines 36..43
                        server/utils/httpErrors.js on lines 45..52
                        server/utils/httpErrors.js on lines 54..61
                        server/utils/httpErrors.js on lines 63..70
                        server/utils/httpErrors.js on lines 72..79

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

                        class Error429 extends HttpError {
                          constructor(properties) {
                            super();
                            this.status = 429;
                            this.code = 'TOO_MANY_REQUESTS';
                        Severity: Major
                        Found in server/utils/httpErrors.js and 7 other locations - About 1 hr to fix
                        server/utils/httpErrors.js on lines 9..16
                        server/utils/httpErrors.js on lines 18..25
                        server/utils/httpErrors.js on lines 27..34
                        server/utils/httpErrors.js on lines 36..43
                        server/utils/httpErrors.js on lines 45..52
                        server/utils/httpErrors.js on lines 54..61
                        server/utils/httpErrors.js on lines 72..79

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language