GladysProject/Gladys

View on GitHub

Showing 742 of 2,674 total issues

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

module.exports = function WeatherController(gladys) {
  /**
   * @api {get} /api/v1/user/:user_selector/weather get weather user
   * @apiName getWeatherUser
   * @apiGroup Weather
Severity: Minor
Found in server/api/controllers/weather.controller.js - About 1 hr to fix

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

      User.associate = (models) => {
        User.hasMany(models.Location, {
          foreignKey: 'user_id',
          sourceKey: 'id',
          as: 'locations',
    Severity: Minor
    Found in server/models/user.js - About 1 hr to fix

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

      function transformDevice(device) {
        const { mac, hostname, ip, vendor } = device;
        const deviceExternalId = `lan-manager:${mac.replaceAll(':', '').toLowerCase()}`;
      
        const params = [];
      Severity: Minor
      Found in server/services/lan-manager/lib/lan-manager.transformDevice.js - About 1 hr to fix

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

        async function downloadBackup(fileUrl) {
          const encryptKey = await this.variable.getValue('GLADYS_GATEWAY_BACKUP_KEY');
          if (encryptKey === null) {
            throw new NotFoundError('GLADYS_GATEWAY_BACKUP_KEY_NOT_FOUND');
          }
        Severity: Minor
        Found in server/lib/gateway/gateway.downloadBackup.js - About 1 hr to fix

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

          async function discover() {
            if (!this.connected) {
              await this.connect();
            }
          
          
          Severity: Minor
          Found in server/services/ewelink/lib/device/discover.js - About 1 hr to fix

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

            async function loginTwoFactor(twoFactorToken, twoFactorCode) {
              // We login with two factor code
              await this.gladysGatewayClient.loginInstance(twoFactorToken, twoFactorCode);
              // we get all variables
              const gladysGatewayRefreshToken = await this.variable.getValue('GLADYS_GATEWAY_REFRESH_TOKEN');
            Severity: Minor
            Found in server/lib/gateway/gateway.loginTwoFactor.js - About 1 hr to fix

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

                addFeature() {
                  const featureData = this.state.selectedFeature.split('|');
              
                  let defaultValues = {};
              
              
              Severity: Minor
              Found in front/src/routes/integration/all/mqtt/device-page/setup/index.js - About 1 hr to fix

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

                  render({}, { houses }) {
                    return (
                      <div>
                        {this.props.trigger.type === EVENTS.HOUSE.EMPTY && (
                          <p>
                Severity: Minor
                Found in front/src/routes/scene/edit-scene/triggers/HouseEmptyOrNot.jsx - About 1 hr to fix

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

                    render(props, { selectedOption, userOptions, houseOptions, selectedHouseOption }) {
                      return (
                        <div>
                          <p>
                            {props.action.type === ACTIONS.USER.SET_SEEN_AT_HOME && (
                  Severity: Minor
                  Found in front/src/routes/scene/edit-scene/actions/UserPresence.jsx - About 1 hr to fix

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

                      render(props, { userOptions, selectedOption, houseOptions, selectedHouseOption }) {
                        return (
                          <div>
                            <p>
                              {props.trigger.type === EVENTS.USER_PRESENCE.BACK_HOME && (
                    Severity: Minor
                    Found in front/src/routes/scene/edit-scene/triggers/UserPresenceTrigger.jsx - About 1 hr to fix

                      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 render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render(props, {}) {
                            const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}HumidityInRoom.${props.x}_${props.y}`);
                            const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}HumidityInRoom.${props.x}_${props.y}`);
                            const humidity = get(boxData, 'room.humidity.humidity');
                            const unit = get(boxData, 'room.humidity.unit');
                        Severity: Minor
                        Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx - About 1 hr to fix

                          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 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 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 determineTypeAndTraits has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

                                  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 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 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 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
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language