GladysProject/Gladys

View on GitHub

Showing 754 of 2,690 total issues

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

module.exports = (sequelize, DataTypes) => {
  const scene = sequelize.define(
    't_scene',
    {
      id: {
Severity: Major
Found in server/models/scene.js - About 2 hrs to fix

    Function newValueCube has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function newValueCube(message, data) {
      const { sid } = message;
      logger.debug(`Xiaomi : New value cube, sid = ${sid}`);
      const newSensor = {
        service_id: this.serviceId,
    Severity: Major
    Found in server/services/xiaomi/lib/event/xiaomi.newValueCube.js - About 2 hrs to fix

      Function BluetoothController has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function BluetoothController(bluetoothManager) {
        /**
         * @api {get} /api/v1/service/bluetooth/status Get Bluetooth status
         * @apiName getStatus
         * @apiGroup Bluetooth
      Severity: Major
      Found in server/services/bluetooth/api/bluetooth.controller.js - About 2 hrs to fix

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

        function createActions(store) {
          const actions = {
            resetPreferences() {
              store.setState({
                signupUserPreferences: {
        Severity: Major
        Found in front/src/actions/signup/signupSetPreferences.js - About 2 hrs to fix

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

            render(props, { showPassword }) {
              const gladysNotAvailable = props.mqttConnectionError === RequestStatus.NetworkError;
              return (
                <form>
                  <div class="form-group">
          Severity: Major
          Found in front/src/routes/integration/all/mqtt/setup-page/SetupForm.jsx - About 2 hrs to fix

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

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

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

                up: async () => {
                  // Get Tasmota service
                  const service = await db.Service.findOne({
                    attributes: ['id'],
                    where: {
              Severity: Major
              Found in server/migrations/20230102171731-update-tasmota-energy-features.js - About 2 hrs to fix

                Function installContainer has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function sendState has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function sendState(hkAccessory, feature, event) {
                    const { Characteristic, Service } = this.hap;
                    switch (`${feature.category}:${feature.type}`) {
                      case `${DEVICE_FEATURE_CATEGORIES.LIGHT}:${DEVICE_FEATURE_TYPES.LIGHT.BINARY}`:
                      case `${DEVICE_FEATURE_CATEGORIES.SWITCH}:${DEVICE_FEATURE_TYPES.SWITCH.BINARY}`:
                  Severity: Major
                  Found in server/services/homekit/lib/sendState.js - About 2 hrs to fix

                    Function newValueGateway has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function newValueGateway(message, data) {
                      const { sid } = message;
                      logger.debug(`Xiaomi : New value gateway, sid = ${sid}`);
                      if (message.cmd === 'heartbeat' && message.token) {
                        const newSensor = {
                    Severity: Major
                    Found in server/services/xiaomi/lib/event/xiaomi.newValueGateway.js - About 2 hrs to fix

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

                        render(props, {}) {
                          return (
                            <div>
                              <div class="form-group" style={maxWidth}>
                                <label class="form-label" for="deviceName">
                      Severity: Major
                      Found in front/src/components/device/UpdateDeviceForm.jsx - About 2 hrs to fix

                        File index.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { Component } from 'preact';
                        import { connect } from 'unistore/preact';
                        import actions from '../actions';
                        import FeatureTab from './FeatureTab';
                        import MqttPage from '../../MqttPage';
                        Severity: Minor
                        Found in front/src/routes/integration/all/mqtt/device-page/setup/index.js - About 2 hrs to fix

                          Function newValueSmoke has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function newValueSmoke(message, data) {
                            const { sid } = message;
                            logger.debug(`Xiaomi : New value smoke, sid = ${sid}`);
                            const newSensor = {
                              service_id: this.serviceId,
                          Severity: Major
                          Found in server/services/xiaomi/lib/event/xiaomi.newValueSmoke.js - About 2 hrs to fix

                            Function configureContainer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            async function configureContainer(basePathOnContainer, config, setupMode = false) {
                              logger.info('Z2M Docker container is being configured...');
                            
                              // Create configuration path (if not exists)
                              const configFilepath = path.join(basePathOnContainer, DEFAULT.CONFIGURATION_PATH);
                            Severity: Major
                            Found in server/services/zigbee2mqtt/lib/configureContainer.js - About 2 hrs to fix

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

                                render(props, state) {
                                  const {
                                    selectedOption,
                                    userOptions,
                                    houseOptions,
                              Severity: Major
                              Found in front/src/routes/scene/edit-scene/actions/CheckUserPresence.jsx - About 2 hrs to fix

                                Function onMessage has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function onMessage(msg, rsinfo) {
                                  const message = JSON.parse(msg.toString());
                                  const ip = rsinfo.address;
                                  logger.debug(message);
                                  const data = message.data ? JSON.parse(message.data) : null;
                                Severity: Major
                                Found in server/services/xiaomi/lib/event/xiaomi.onMessage.js - About 2 hrs to fix

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

                                  function createActions(store) {
                                    const actions = {
                                      async getHouses(state) {
                                        store.setState({
                                          housesGetStatus: RequestStatus.Getting
                                  Severity: Major
                                  Found in front/src/routes/integration/all/broadlink/peripheral-page/actions.js - About 2 hrs to fix

                                    File CalendarEventIsComing.jsx has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import { Component } from 'preact';
                                    import { connect } from 'unistore/preact';
                                    
                                    import cx from 'classnames';
                                    import get from 'get-value';
                                    Severity: Minor
                                    Found in front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx - About 2 hrs to fix

                                      Function DeviceController has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      module.exports = function DeviceController(gladys) {
                                        /**
                                         * @api {get} /api/v1/device/:device_selector getBySelector
                                         * @apiName getBySelector
                                         * @apiGroup Device
                                      Severity: Major
                                      Found in server/api/controllers/device.controller.js - About 2 hrs to fix

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

                                        module.exports = (sequelize, DataTypes) => {
                                          const message = sequelize.define(
                                            't_message',
                                            {
                                              id: {
                                        Severity: Major
                                        Found in server/models/message.js - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language