GladysProject/Gladys

View on GitHub

Showing 737 of 2,655 total issues

File demo.js has 4153 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import dayjs from 'dayjs';

const data = {
  'post /api/v1/login': {
    id: '215811c9-c0aa-4148-8a4b-e02892d7446f',
Severity: Major
Found in front/src/config/demo.js - About 1 wk to fix

    File constants.js has 1106 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const STATE = {
      ON: 1,
      OFF: 0,
    };
    
    
    Severity: Major
    Found in server/utils/constants.js - About 2 days to fix

      Function getRoutes has 511 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getRoutes(gladys) {
        const areaController = AreaController(gladys);
        const calendarController = CalendarController(gladys);
        const cameraController = CameraController(gladys);
        const dashboardController = DashboardController(gladys);
      Severity: Major
      Found in server/api/routes.js - About 2 days to fix

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

        function createActions(store) {
          const actions = {
            async getStatus(state) {
              store.setState({
                gatewayGetStatusStatus: RequestStatus.Getting
        Severity: Major
        Found in front/src/actions/gateway.js - About 2 days to fix

          File numericType.js has 779 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES, DEVICE_FEATURE_UNITS } = require('../../../utils/constants');
          
          module.exports = {
            type: 'numeric',
            writeValue: (expose, value) => {
          Severity: Major
          Found in server/services/zigbee2mqtt/exposes/numericType.js - About 1 day to fix

            Function createActions has 293 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/actions/house.js - About 1 day to fix

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

                render(props, {}) {
                  return (
                    <div class="card">
                      <div class="card-header">
                        <h1 class="card-title">
              Severity: Major
              Found in front/src/routes/integration/all/zigbee2mqtt/setup-page/SetupTab.jsx - About 1 day to fix

                Function createActions has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
                Open

                function createActions(store) {
                  const actions = {
                    async getStatus(state) {
                      store.setState({
                        gatewayGetStatusStatus: RequestStatus.Getting
                Severity: Minor
                Found in front/src/actions/gateway.js - About 1 day to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                function createActions(store) {
                  const actions = {
                    async getMySelf(state) {
                      store.setState({
                        ProfileGetStatus: RequestStatus.Getting,
                Severity: Major
                Found in front/src/actions/profile.js - About 1 day to fix

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

                    render({}, {}) {
                      const language = get(this.props, 'user.language');
                      const localeSet = language === 'fr' ? fr : 'en';
                      const time = this.props.trigger.time
                        ? new Date().setHours(this.props.trigger.time.substr(0, 2), this.props.trigger.time.substr(3, 2))
                  Severity: Major
                  Found in front/src/routes/scene/edit-scene/triggers/ScheduledTrigger.jsx - About 1 day to fix

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

                      render(
                        props,
                        {
                          nodeRedEnabled,
                          dockerBased,
                    Severity: Major
                    Found in front/src/routes/integration/all/node-red/setup-page/SetupTab.jsx - About 1 day to fix

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

                      function createActions(store) {
                        const integrationActions = createActionsIntegration(store);
                        const actions = {
                          async complete(camera) {
                            const cameraUrlParam = camera.params.find(param => param.name === 'CAMERA_URL');
                      Severity: Major
                      Found in front/src/routes/integration/all/rtsp-camera/actions.js - About 1 day to fix

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

                          render(
                            {
                              deviceIndex,
                              editable,
                              deleteButton,
                        Severity: Major
                        Found in front/src/routes/integration/all/netatmo/NetatmoDeviceBox.jsx - About 1 day to fix

                          Function createActions has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function createActions(store) {
                            const actions = {
                              async getMySelf(state) {
                                store.setState({
                                  ProfileGetStatus: RequestStatus.Getting,
                          Severity: Minor
                          Found in front/src/actions/profile.js - About 1 day to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          File routes.js has 535 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          const AreaController = require('./controllers/area.controller');
                          const CalendarController = require('./controllers/calendar.controller');
                          const CameraController = require('./controllers/camera.controller');
                          const DashboardController = require('./controllers/dashboard.controller');
                          const DeviceController = require('./controllers/device.controller');
                          Severity: Major
                          Found in server/api/routes.js - About 1 day to fix

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

                              render(
                                { deviceIndex, device, housesWithRooms, editable, ...props },
                                { loading, errorMessage, authErrorMessage, tooMuchStatesError, statesNumber }
                              ) {
                                const validModel = device.features.length > 0 || device.needAuthentication;
                            Severity: Major
                            Found in front/src/routes/integration/all/tasmota/TasmotaDeviceBox.jsx - About 1 day to fix

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

                                render(
                                  props,
                                  {
                                    initialized,
                                    loading,
                              Severity: Major
                              Found in front/src/components/boxs/chart/Chart.jsx - About 1 day to fix

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

                                function createActions(store) {
                                  const integrationActions = createActionsIntegration(store);
                                  const actions = {
                                    async loadProps(state) {
                                      let eweLinkUsername;
                                Severity: Major
                                Found in front/src/routes/integration/all/ewelink/actions.js - About 1 day to fix

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

                                  import { Component } from 'preact';
                                  import { connect } from 'unistore/preact';
                                  import update from 'immutability-helper';
                                  import { route } from 'preact-router';
                                  import { DndProvider } from 'react-dnd';
                                  Severity: Minor
                                  Found in front/src/routes/scene/edit-scene/index.js - About 7 hrs to fix

                                    File scene.actions.js has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    const Promise = require('bluebird');
                                    const Handlebars = require('handlebars');
                                    const cloneDeep = require('lodash.clonedeep');
                                    const {
                                      create,
                                    Severity: Minor
                                    Found in server/lib/scene/scene.actions.js - About 7 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language