GladysProject/Gladys

View on GitHub

Showing 742 of 2,674 total issues

Function BroadlinkController has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function BroadlinkController(broadlinkManager) {
  /**
   * @api {get} /api/v1/service/broadlink/peripheral Get discovered Broadlink peripherals.
   * @apiName getPeripheral
   * @apiGroup Broadlink
Severity: Minor
Found in server/services/broadlink/api/broadlink.controller.js - About 1 hr to fix

    Function updateNAPlug has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function updateNAPlug(deviceGladys, deviceNetatmo, externalId) {
      try {
        deviceGladys.features
          .filter((feature) => feature.external_id === `${externalId}:rf_strength`)
          .forEach((feature) => {
    Severity: Minor
    Found in server/services/netatmo/lib/update/netatmo.updateNAPlug.js - About 1 hr to fix

      Function DeviceManager has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const DeviceManager = function DeviceManager(
        eventManager,
        messageManager,
        stateManager,
        serviceManager,
      Severity: Minor
      Found in server/lib/device/index.js - About 1 hr to fix

        Function load has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function load(gladys) {
          const SERVICES_TO_LOAD = Object.keys(this.servicesFromFiles);
          await Promise.all(
            SERVICES_TO_LOAD.map(async (service) => {
              const serviceToInsertOrUpdate = {
        Severity: Minor
        Found in server/lib/service/service.load.js - About 1 hr to fix

          Function start has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              start: async () => {
                // set wal mode
                await db.sequelize.query('PRAGMA journal_mode=WAL;');
          
                // Execute DB migrations
          Severity: Minor
          Found in server/lib/index.js - About 1 hr to fix

            Function savePreferences has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async savePreferences(state) {
                  // saving user preferences
                  store.setState({
                    signupSaveUserPreferences: RequestStatus.Getting
                  });
            Severity: Minor
            Found in front/src/actions/signup/signupSetPreferences.js - About 1 hr to fix

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

                render(props, {}) {
                  const loading =
                    props.ProfileGetStatus === RequestStatus.Getting || props.ProfilePatchStatus === RequestStatus.Getting;
                  const profileSavedSuccess = props.ProfilePatchStatus === RequestStatus.Success;
                  return (
              Severity: Minor
              Found in front/src/routes/settings/settings-users/edit-user/index.js - About 1 hr to fix

                Function saveDevice has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async saveDevice() {
                    this.setState({
                      loading: true
                    });
                    try {
                Severity: Minor
                Found in front/src/routes/integration/all/mqtt/device-page/setup/index.js - About 1 hr to fix

                  Function initLeafletMap has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async initLeafletMap(state) {
                        if (state.signupHouseLeafletMap) {
                          state.signupHouseLeafletMap.remove();
                        }
                        const leafletMap = leaflet.map('select-house-location-map').setView([48.8583, 2.2945], 2);
                  Severity: Minor
                  Found in front/src/actions/signup/signupConfigureHouse.js - About 1 hr to fix

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

                      render(props, { alarmModesOptions, houseOptions, selectedHouseOption, selectedAlarmModeOption }) {
                        return (
                          <div>
                            <p>
                              <Text id="editScene.actionsCard.alarmSetMode.description" />
                    Severity: Minor
                    Found in front/src/routes/scene/edit-scene/actions/SetAlarmMode.jsx - About 1 hr to fix

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

                        render(props, {}) {
                          const variableOptions = [];
                      
                          props.actionsGroupsBefore.forEach((actionGroup, groupIndex) => {
                            actionGroup.forEach((action, index) => {

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

                          render(props, { alarmModesOptions, houseOptions, selectedHouseOption, selectedAlarmModeOption }) {
                            return (
                              <div>
                                <p>
                                  <Text id="editScene.actionsCard.alarmCheckMode.description" />
                        Severity: Minor
                        Found in front/src/routes/scene/edit-scene/actions/CheckAlarmMode.jsx - About 1 hr to fix

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

                            up: async (queryInterface, Sequelize) => {
                              const service = await db.Service.findOne({
                                where: {
                                  name: 'enedis',
                                },
                          Severity: Minor
                          Found in server/migrations/20230518062954-enedis-reset-aggregate.js - About 1 hr to fix

                            Function DashboardController has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

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

                              function setValue(device, deviceFeature, value) {
                                if (!deviceFeature.external_id.startsWith('zwavejs-ui:')) {
                                  throw new BadParameters(
                                    `ZWaveJs-UI deviceFeature external_id is invalid: "${deviceFeature.external_id}" should starts with "zwavejs-ui:"`,
                                  );
                              Severity: Minor
                              Found in server/services/zwavejs-ui/lib/zwaveJSUI.setValue.js - About 1 hr to fix

                                Function VariableController has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                module.exports = function VariableController(gladys) {
                                  /**
                                   * @api {post} /api/service/:service_name/variable/:variable_key Save service variable
                                   * @apiName SaveVariable
                                   * @apiGroup Variable
                                Severity: Minor
                                Found in server/api/controllers/variable.controller.js - About 1 hr to fix

                                  Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  module.exports = (sequelize, DataTypes) => {
                                    const deviceFeatureState = sequelize.define(
                                      't_device_feature_state',
                                      {
                                        id: {
                                  Severity: Minor
                                  Found in server/models/device_feature_state.js - About 1 hr to fix

                                    Function buildFeatures has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function buildFeatures(deviceName, deviceExternalId, broadlinkDevice) {
                                      const { TYPE, getEnergy } = broadlinkDevice;
                                      const features = [];
                                    
                                      // check for number of switch features
                                    Severity: Minor
                                    Found in server/services/broadlink/lib/commands/features/broadlink.switch.js - About 1 hr to fix

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

                                      async function getConfiguration() {
                                        const mqttUrl = await this.gladys.variable.getValue(CONFIGURATION.MQTT_URL_KEY, this.serviceId);
                                        const mqttUsername = await this.gladys.variable.getValue(CONFIGURATION.MQTT_USERNAME_KEY, this.serviceId);
                                        const mqttPassword = await this.gladys.variable.getValue(CONFIGURATION.MQTT_PASSWORD_KEY, this.serviceId);
                                      
                                      
                                      Severity: Minor
                                      Found in server/services/mqtt/lib/getConfiguration.js - About 1 hr to fix

                                        Function getUsersKeys has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        async function getUsersKeys() {
                                          try {
                                            const onlineUsers = await this.gladysGatewayClient.getUsersInstance();
                                            let localUsers = await this.variable.getValue('GLADYS_GATEWAY_USERS_KEYS');
                                            localUsers = localUsers !== null ? JSON.parse(localUsers) : [];
                                        Severity: Minor
                                        Found in server/lib/gateway/gateway.getUsersKeys.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language