GladysProject/Gladys

View on GitHub

Showing 754 of 2,690 total issues

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

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

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

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

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

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

        Function action.devices.commands.ColorAbsolute has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            'action.devices.commands.ColorAbsolute': (device, params) => {
              const events = [];
              const { color = {} } = params;
              const { temperature, spectrumRGB } = color;
        
        

          Function syncDeviceConverter has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function syncDeviceConverter(device) {
            const endpoint = {
              endpointId: device.selector,
              friendlyName: device.name,
              manufacturerName: 'Gladys Assistant',
          Severity: Minor
          Found in server/services/alexa/lib/syncDeviceConverter.js - About 1 hr to fix

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

            function createActions(store) {
              const actions = {
                async getUsersWithLocation(state) {
                  store.setState({
                    GetUsersWithlocationStatus: RequestStatus.Getting
            Severity: Minor
            Found in front/src/actions/map.js - About 1 hr to fix

              Function getZigbee2mqttDevices has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  async getZigbee2mqttDevices(state, take, skip) {
                    store.setState({
                      getZigbee2mqttStatus: RequestStatus.Getting
                    });
                    try {
              Severity: Minor
              Found in front/src/routes/integration/all/zigbee2mqtt/device-page/actions.js - About 1 hr to fix

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

                  render({}, { deviceStateHistoryInDays }) {
                    return (
                      <div class="card">
                        <h4 class="card-header">
                          <Text id="systemSettings.deviceStateRetentionTime" />

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

                    render(props, { saving, error, variables, scene, triggersVariables, tags }) {
                      return (
                        scene && (
                          <div>
                            <DndProvider backend={this.isTouchDevice ? TouchBackend : HTML5Backend}>
                  Severity: Minor
                  Found in front/src/routes/scene/edit-scene/index.js - About 1 hr to fix

                    Function discoverDevices has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function discoverDevices() {
                      logger.debug('Looking for MELCloud devices...');
                      if (this.status !== STATUS.CONNECTED) {
                        this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
                          type: WEBSOCKET_MESSAGE_TYPES.MELCLOUD.STATUS,
                    Severity: Minor
                    Found in server/services/melcloud/lib/melcloud.discoverDevices.js - About 1 hr to fix

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

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

                        Function setupRoutes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function setupRoutes(gladys) {
                          const router = express.Router();
                          const routes = getRoutes(gladys);
                          const authMiddleware = AuthMiddleware('dashboard:write', gladys);
                          const isInstanceConfiguredMiddleware = IsInstanceConfiguredMiddleware(gladys);
                        Severity: Minor
                        Found in server/api/setupRoutes.js - About 1 hr to fix

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

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

                            Function handleNewMessage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function handleNewMessage(topic, message) {
                              logger.debug(`Receives MQTT message from ${topic} : ${message}`);
                            
                              try {
                                // If debug mode is enabled, send message to UI
                            Severity: Minor
                            Found in server/services/mqtt/lib/handleNewMessage.js - About 1 hr to fix

                              Function update has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function update(selector, scene) {
                                const existingScene = await db.Scene.findOne({
                                  where: {
                                    selector,
                                  },
                              Severity: Minor
                              Found in server/lib/scene/scene.update.js - About 1 hr to fix

                                Function getBySelector has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function getBySelector(selector, options) {
                                  const optionsWithDefault = { ...DEFAULT_OPTIONS, ...options };
                                  const include = [];
                                  if (optionsWithDefault.expand.includes('devices')) {
                                    include.push({
                                Severity: Minor
                                Found in server/lib/room/room.getBySelector.js - About 1 hr to fix

                                  Function getHumidityInRoom has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  async function getHumidityInRoom(roomId, options) {
                                    logger.debug(`Getting average humidity in room ${roomId}`);
                                    const optionsWithDefault = { ...DEFAULT_PARAMETERS, ...options };
                                  
                                    const oneHourAgo = new Date(new Date().getTime() - 1 * 60 * 60 * 1000);

                                    Function handleAlexaMessage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    async function handleAlexaMessage(data, rawMessage, cb) {
                                      try {
                                        const service = this.serviceManager.getService('alexa');
                                        const body = {
                                          ...data.data,
                                    Severity: Minor
                                    Found in server/lib/gateway/gateway.handleAlexaMessage.js - About 1 hr to fix

                                      Function add has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function add(device) {
                                        this.stateManager.setState('device', device.selector, device);
                                        this.stateManager.setState('deviceByExternalId', device.external_id, device);
                                        this.stateManager.setState('deviceById', device.id, device);
                                        device.features.forEach((feature) => {
                                      Severity: Minor
                                      Found in server/lib/device/device.add.js - About 1 hr to fix

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

                                          connect() {
                                            const websocketUrl = config.webSocketUrl || window.location.origin.replace('http', 'ws');
                                            if (this.ws && this.ws.close) {
                                              this.ws.close();
                                            }
                                        Severity: Minor
                                        Found in front/src/utils/Session.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language