GladysProject/Gladys

View on GitHub

Showing 754 of 2,690 total issues

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

  render(props, { userOptions, selectedOption, areaOptions, selectedAreaOption }) {
    return (
      <div>
        <p>
          {props.trigger.type === EVENTS.AREA.USER_ENTERED && (

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

      render(props, { selectedDeviceFeature }) {
        let binaryDevice = false;
        let presenceDevice = false;
        let buttonClickDevice = false;
    
    
    Severity: Minor
    Found in front/src/routes/scene/edit-scene/triggers/DeviceFeatureState.jsx - About 1 hr to fix

      Function up has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        up: async (queryInterface, Sequelize) => {
          await queryInterface.createTable('t_script', {
            id: {
              allowNull: false,
              primaryKey: true,
      Severity: Minor
      Found in server/migrations/20190211044205-create-script.js - About 1 hr to fix

        Function determineTypeAndTraits has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function determineTypeAndTraits(device) {
          const featureCategoryTypes = {};
          let type;
          const traits = [];
          let attributes = {};

          Function AreaController has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function AreaController(gladys) {
            /**
             * @api {post} /api/v1/area create
             * @apiName create
             * @apiGroup Area
          Severity: Minor
          Found in server/api/controllers/area.controller.js - About 1 hr to fix

            Function poll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function poll(device) {
              const externalId = device.external_id;
              const [prefix, topic] = device.external_id.split(':');
            
              if (prefix !== 'tuya') {
            Severity: Minor
            Found in server/services/tuya/lib/tuya.poll.js - About 1 hr to fix

              Function connect has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function connect(configuration) {
                const { baseUrl, accessKey, secretKey } = configuration;
              
                if (!baseUrl || !accessKey || !secretKey) {
                  this.status = STATUS.NOT_INITIALIZED;
              Severity: Minor
              Found in server/services/tuya/lib/tuya.connect.js - About 1 hr to fix

                Function checkForContainerUpdates has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function checkForContainerUpdates(config) {
                  logger.info('Checking for current installed versions and required updates...');
                
                  // Check for MQTT container version
                  if (config.dockerMqttVersion !== DEFAULT.DOCKER_MQTT_VERSION) {
                Severity: Minor
                Found in server/services/zigbee2mqtt/lib/checkForContainerUpdates.js - About 1 hr to fix

                  Function getAccessToken has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function getAccessToken(refreshToken, scope) {
                    if (!refreshToken || refreshToken.length === 0) {
                      throw new BadParameters();
                    }
                    const refreshTokenHash = hashRefreshToken(refreshToken);
                  Severity: Minor
                  Found in server/lib/session/session.getAccessToken.js - About 1 hr to fix

                    Function throwErrorIfNeeded has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function throwErrorIfNeeded(response, emit = false, config = false) {
                      if (response.error) {
                        if (response.error === 406) {
                          this.connected = false;
                          this.accessToken = '';
                    Severity: Minor
                    Found in server/services/ewelink/lib/device/index.js - About 1 hr to fix

                      Function EwelinkController has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function EwelinkController(eweLinkHandler) {
                        /**
                         * @api {post} /api/v1/service/ewelink/connect Connect to eWeLink cloud account.
                         * @apiName save
                         * @apiGroup Ewelink
                      Severity: Minor
                      Found in server/services/ewelink/api/ewelink.controller.js - About 1 hr to fix

                        Function command has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        async function command(message, classification, context) {
                          const cameraImages = [];
                        
                          const roomEntity = classification.entities.find((entity) => entity.entity === 'room');
                          const deviceEntity = classification.entities.find((entity) => entity.entity === 'device');
                        Severity: Minor
                        Found in server/lib/device/camera/camera.command.js - About 1 hr to fix

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

                          function createActions(store) {
                            const actions = {
                              async loadProfilePicture(state) {
                                // if a profile picture already exist
                                if (state.profilePicture) {
                          Severity: Minor
                          Found in front/src/actions/profilePicture.js - About 1 hr to fix

                            Function promise has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              const promise = new Promise((resolve, reject) => {
                                let err = '';
                                const childProcess = spawn('node', [SCRIPT_PATH, JSON.stringify(params)]);
                            
                                childProcess.stdout.on('data', async (data) => {
                            Severity: Minor
                            Found in server/lib/device/device.calculateAggregate.js - About 1 hr to fix

                              Function disarm has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function disarm(selector) {
                                // In case there is a timeout to arm this house, we clear it
                                clearTimeout(this.armingHouseTimeout.get(selector));
                                if (this.armingHouseTimeout.get(selector)) {
                                  this.armingHouseTimeout.delete(selector);
                              Severity: Minor
                              Found in server/lib/house/house.disarm.js - About 1 hr to fix

                                Function getEventsInRange has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    async getEventsInRange(state, from, to) {
                                      store.setState({
                                        DeviceGetStatus: CalendarGetEventsStatus.Getting
                                      });
                                      try {
                                Severity: Minor
                                Found in front/src/actions/calendar.js - About 1 hr to fix

                                  Function saveCaldavSettings has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    async saveCaldavSettings(state) {
                                      store.setState({
                                        caldavSaveSyncStatus: CalDAVStatus.Getting
                                      });
                                      try {
                                  Severity: Minor
                                  Found in front/src/routes/integration/all/caldav/sync-page/actions.js - About 1 hr to fix

                                    Function saveNextcloudTalkSettings has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      async saveNextcloudTalkSettings(state) {
                                        store.setState({
                                          nextcloudTalkSaveSettingsStatus: RequestStatus.Getting
                                        });
                                        try {
                                    Severity: Minor
                                    Found in front/src/routes/integration/all/nextcloud-talk/actions.js - About 1 hr to fix

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

                                        render(
                                          props,
                                          { name, color, radius, latitude, longitude, houses, loading, createAreaError, deleteAreaError, getAreaError }
                                        ) {
                                          return (
                                      Severity: Minor
                                      Found in front/src/routes/map/NewArea.jsx - About 1 hr to fix

                                        Function BadgeNumberDeviceValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        const BadgeNumberDeviceValue = props => {
                                          const { category, type, last_value: lastValue = null, unit } = props.deviceFeature;
                                        
                                          const colorMethod = BADGE_CATEGORIES[category];
                                          if (!colorMethod) {
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language