GladysProject/Gladys

View on GitHub

Showing 494 of 1,770 total issues

File demo.js has 2398 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 6 days to fix

    Function getRoutes has 458 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 445 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

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

            render(props, {}) {
              return (
                <div class="card">
                  <div class="card-header">
                    <h3 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

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

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

              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 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

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

                    render({ deviceIndex, device, housesWithRooms, editable, ...props }, { loading, errorMessage, authErrorMessage }) {
                      const validModel = device.features.length > 0 || device.needAuthentication;
                      // default value is 'mqtt'
                      const deviceProtocol = ((device.params || []).find(p => p.name === 'protocol') || { value: 'mqtt' }).value;
                  
                  
                  Severity: Major
                  Found in front/src/routes/integration/all/tasmota/TasmotaDeviceBox.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

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

                        render(props, { loading, series, labels, dropdown, variation, lastValueRounded, interval, emptySeries }) {
                          const displayVariation = props.box.display_variation;
                          return (
                            <div class="card">
                              <div class="card-body">
                      Severity: Major
                      Found in front/src/components/boxs/chart/Chart.jsx - About 7 hrs to fix

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

                        function createActions(store) {
                          const integrationActions = createActionsIntegration(store);
                          const actions = {
                            async getRtspCameraDevices(state) {
                              store.setState({
                        Severity: Major
                        Found in front/src/routes/integration/all/rtsp-camera/actions.js - About 7 hrs to fix

                          File routes.js has 482 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: Minor
                          Found in server/api/routes.js - About 7 hrs to fix

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

                            function createActions(store) {
                              const integrationActions = createActionsIntegration(store);
                              const actions = {
                                async getTasmotaDevices(state) {
                                  store.setState({
                            Severity: Major
                            Found in front/src/routes/integration/all/tasmota/actions.js - About 7 hrs to fix

                              File gateway.js has 453 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import get from 'get-value';
                              import update from 'immutability-helper';
                              import { RequestStatus, LoginStatus } from '../utils/consts';
                              import { validateEmail } from '../utils/validator';
                              import { ERROR_MESSAGES, SYSTEM_VARIABLE_NAMES } from '../../../server/utils/constants';
                              Severity: Minor
                              Found in front/src/actions/gateway.js - About 6 hrs to fix

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

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

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

                                  function createActions(store) {
                                    const actions = {
                                      async ping(state) {
                                        store.setState({
                                          PingStatus: RequestStatus.Getting
                                  Severity: Major
                                  Found in front/src/actions/system.js - About 6 hrs to fix

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

                                    function createActions(store) {
                                      const actionsProfilePicture = createActionsProfilePicture(store);
                                      const welcomeActions = createActionsWelcome(store);
                                    
                                      const actions = {
                                    Severity: Major
                                    Found in front/src/actions/signup/signupCreateLocalAccount.js - About 6 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language