GladysProject/Gladys

View on GitHub

Showing 737 of 2,655 total issues

File ActionCard.jsx has 392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { h } from 'preact';
import { Text } from 'preact-i18n';
import cx from 'classnames';
import { useRef } from 'preact/hooks';
import { useDrag, useDrop } from 'react-dnd';
Severity: Minor
Found in front/src/routes/scene/edit-scene/ActionCard.jsx - About 5 hrs to fix

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

      render(
        {
          deviceIndex,
          editable,
          editButton,
    Severity: Major
    Found in front/src/routes/integration/all/melcloud/MELCloudDeviceBox.jsx - About 5 hrs to fix

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

        render(
          {
            deviceIndex,
            editable,
            editButton,
      Severity: Major
      Found in front/src/routes/integration/all/tuya/TuyaDeviceBox.jsx - About 5 hrs to fix

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

        function createActions(store) {
          const actionsProfilePicture = createActionsProfilePicture(store);
          const actions = {
            init(state, returnUrl) {
              const newState = {
        Severity: Minor
        Found in front/src/actions/login/loginGateway.js - About 5 hrs 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 129 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createActions(store) {
          const actionsProfilePicture = createActionsProfilePicture(store);
          const actions = {
            init(state, returnUrl) {
              const newState = {
        Severity: Major
        Found in front/src/actions/login/loginGateway.js - About 5 hrs to fix

          Function onExecute has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function onExecute(body) {
            const directiveNamespace = get(body, 'directive.header.namespace');
            const directiveName = get(body, 'directive.header.name');
            const endpointId = get(body, 'directive.endpoint.endpointId');
            const correlationToken = get(body, 'directive.header.correlationToken');
          Severity: Major
          Found in server/services/alexa/lib/alexa.onExecute.js - About 5 hrs to fix

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

              render(
                props,
                {
                  loading,
                  configured,
            Severity: Major
            Found in front/src/routes/integration/all/zwavejs-ui/setup-page/index.js - About 5 hrs to fix

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

                render({ trigger }, { calendarsOptions, selectedCalendarsOptions }) {
                  return (
                    <div>
                      <div class="row">
                        <div class="col-md-12">
              Severity: Major
              Found in front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx - About 4 hrs to fix

                Function command has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                async function command(message, classification, context) {
                  try {
                    const houses = await this.house.get();
                    const house = houses[0];
                    if (!house || !house.latitude || !house.longitude) {
                Severity: Minor
                Found in server/lib/weather/weather.command.js - About 4 hrs 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 loadDevices has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function loadDevices() {
                  let listDevices = [];
                
                  if (this.configuration.energyApi || (!this.configuration.energyApi && !this.configuration.weatherApi)) {
                    try {
                Severity: Major
                Found in server/services/netatmo/lib/netatmo.loadDevices.js - About 4 hrs to fix

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

                  function createActions(store) {
                    const actions = {
                      scrollToBottom() {
                        setTimeout(() => {
                          const chatWindow = document.getElementById('chat-window');
                  Severity: Major
                  Found in front/src/actions/message.js - About 4 hrs to fix

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

                      render({ device, houses }, { loading }) {
                        const manufacturer = device.params.find(param => param.name === PARAMS.MANUFACTURER);
                        const macAddress = device.params.find(param => param.name === PARAMS.MAC);
                        const orginalName = device.params.find(param => param.name === PARAMS.NAME);
                    
                    

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

                      function createActions(store) {
                        const actions = {
                          initRoomList() {
                            store.setState({
                              signupRooms: []
                      Severity: Major
                      Found in front/src/actions/signup/signupConfigureHouse.js - About 4 hrs to fix

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

                        function createActions(store) {
                          const houseActions = createActionsHouse(store);
                          const integrationActions = createActionsIntegration(store);
                          const actions = {
                            async getMqttDevices(state) {
                        Severity: Major
                        Found in front/src/routes/integration/all/mqtt/device-page/actions.js - About 4 hrs to fix

                          Function saveHistoricalState has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          async function saveHistoricalState(deviceFeature, newValue, newValueCreatedAt) {
                            // Validate that the number is correct
                            if (Number.isNaN(newValue)) {
                              throw new BadParameters(`device.saveHistoricalState of NaN value on ${deviceFeature.selector}`);
                            }
                          Severity: Major
                          Found in server/lib/device/device.saveHistoricalState.js - About 4 hrs to fix

                            File profile.jsx has 362 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { Text, Localizer } from 'preact-i18n';
                            import cx from 'classnames';
                            import dayjs from 'dayjs';
                            import get from 'get-value';
                            import EditableProfilePicture from './EditableProfilePicture';
                            Severity: Minor
                            Found in front/src/components/user/profile.jsx - About 4 hrs to fix

                              Function convertDeviceWeather has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function convertDeviceWeather(netatmoDevice) {
                                const { home, name, type: model, room = {}, plug = {} } = netatmoDevice;
                                const id = netatmoDevice.id || netatmoDevice._id;
                                const homeId = home || netatmoDevice.home_id;
                                const nameDevice = name || netatmoDevice.module_name || netatmoDevice.station_name;
                              Severity: Major
                              Found in server/services/netatmo/lib/device/netatmo.convertDeviceWeather.js - About 4 hrs to fix

                                Function calculateAggregateChildProcess has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function calculateAggregateChildProcess(params) {
                                  const {
                                    AGGREGATE_STATES_PER_INTERVAL,
                                    DEVICE_FEATURE_STATE_AGGREGATE_TYPES,
                                    LAST_AGGREGATE_ATTRIBUTES,
                                Severity: Major
                                Found in server/lib/device/device.calculcateAggregateChildProcess.js - About 4 hrs to fix

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

                                    render(
                                      { deviceIndex, editable, deleteButton, housesWithRooms },
                                      { device, loading, errorMessage, tooMuchStatesError, statesNumber }
                                    ) {
                                      const validModel = device.features && device.features.length > 0;
                                  Severity: Major
                                  Found in front/src/routes/integration/all/zwavejs-ui/ZwaveJSUIDeviceBox.jsx - About 4 hrs to fix

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

                                      render(props, { house, loading, arming }) {
                                        const armingDisabled = (house && house.alarm_mode === ALARM_MODES.ARMED) || arming;
                                        const partialArmDisabled = (house && house.alarm_mode === ALARM_MODES.PARTIALLY_ARMED) || arming;
                                        const isCurrentlyArmingWithCoutdown = arming && house.alarm_delay_before_arming > 0;
                                        return (
                                    Severity: Major
                                    Found in front/src/components/boxs/alarm/Alarm.jsx - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language