GladysProject/Gladys

View on GitHub

Showing 754 of 2,690 total issues

Function newValuePlug has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

      render(props, { batteryLevel, mostRecentValueAt, loading, tooMuchStatesError, statesNumber }) {
        return (
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">
    Severity: Major
    Found in front/src/routes/integration/all/zwave/node-page/Device.jsx - About 3 hrs to fix

      Function handleMqttMessage has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function handleMqttMessage(topic, message) {
        // Limit events only on status changes
        if (!this.zigbee2mqttConnected) {
          this.zigbee2mqttConnected = true;
          this.zigbee2mqttRunning = true;
      Severity: Major
      Found in server/services/zigbee2mqtt/lib/handleMqttMessage.js - About 3 hrs to fix

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

          render(
            props,
            {
              image,
              error,
        Severity: Major
        Found in front/src/components/boxs/camera/Camera.jsx - About 3 hrs to fix

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

            render({ ipMasks = {}, disabled, updateMaskConfig, deleteMaskConfig }, { name = '', mask = '', valid }) {
              const invalidMask = mask.length > 0 && !valid;
              return (
                <div>
                  <div class="form-group">

            Function newValueTemperatureSensor has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function newValueTemperatureSensor(message, data) {
              const { sid } = message;
              logger.debug(`Xiaomi : New value temperature sensor, sid = ${sid}`);
            
              const newSensor = {
            Severity: Major
            Found in server/services/xiaomi/lib/event/xiaomi.newValueTemperatureSensor.js - About 3 hrs to fix

              File app.jsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { h, Component } from 'preact';
              import { Router } from 'preact-router';
              import createStore from 'unistore';
              import get from 'get-value';
              import config from '../config';
              Severity: Minor
              Found in front/src/components/app.jsx - About 3 hrs to fix

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

                  render(props, { loading, saveError, tooMuchStatesError, statesNumber }) {
                    const { batteryLevel } = this.getDeviceProperty();
                    return (
                      <div class="col-md-6">
                        <div class="card">

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

                    render({ action }, {}) {
                      return (
                        <div>
                          <div class="row">
                            <div class="col-md-12">
                  Severity: Major
                  Found in front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx - About 3 hrs to fix

                    File TasmotaDeviceBox.jsx has 316 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { Component } from 'preact';
                    import { Text, Localizer, MarkupText } from 'preact-i18n';
                    import cx from 'classnames';
                    import { Link } from 'preact-router';
                    import get from 'get-value';
                    Severity: Minor
                    Found in front/src/routes/integration/all/tasmota/TasmotaDeviceBox.jsx - About 3 hrs to fix

                      File WeatherBox.jsx has 316 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { Component } from 'preact';
                      import { connect } from 'unistore/preact';
                      import { Text } from 'preact-i18n';
                      import { Link } from 'preact-router/match';
                      import cx from 'classnames';
                      Severity: Minor
                      Found in front/src/components/boxs/weather/WeatherBox.jsx - About 3 hrs to fix

                        Function actions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const actions = store => ({
                          updateCaldavHost(state, e) {
                            store.setState({
                              caldavHost: e.target.value
                            });
                        Severity: Minor
                        Found in front/src/routes/integration/all/caldav/account-page/actions.js - About 3 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 a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function createActions(store) {
                          const actionsProfilePicture = createActionsProfilePicture(store);
                        
                          const actions = {
                            handleRoute(state, e) {
                        Severity: Minor
                        Found in front/src/actions/main.js - About 3 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 loadDeviceDetails has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        async function loadDeviceDetails(homeData) {
                          const { rooms: roomsHomeData, modules: modulesHomeData, id: homeId } = homeData;
                          let listDevices = [];
                        
                          logger.debug('loading devices details in home id: ', homeId, '...');
                        Severity: Major
                        Found in server/services/netatmo/lib/netatmo.loadDeviceDetails.js - About 3 hrs to fix

                          Function addScene has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function addScene(sceneRaw) {
                            // deep clone the scene so that we don't modify the same object which will be returned to the client
                            const scene = cloneDeep(sceneRaw);
                            // first, if the scene actually exist, we cancel all triggers
                            this.cancelTriggers(scene.selector);
                          Severity: Major
                          Found in server/lib/scene/scene.addScene.js - About 3 hrs to fix

                            Function render has 89 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/sonos/SonosDeviceBox.jsx - About 3 hrs to fix

                              actions has 29 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                                const actions = {
                                  async getStatus(state) {
                                    store.setState({
                                      gatewayGetStatusStatus: RequestStatus.Getting
                                    });
                              Severity: Minor
                              Found in front/src/actions/gateway.js - About 3 hrs to fix

                                EditScene has 29 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class EditScene extends Component {
                                  getSceneBySelector = async () => {
                                    this.setState({
                                      SceneGetStatus: RequestStatus.Getting
                                    });
                                Severity: Minor
                                Found in front/src/routes/scene/edit-scene/index.js - About 3 hrs to fix

                                  File Camera.jsx has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { Component, createRef } from 'preact';
                                  import { connect } from 'unistore/preact';
                                  import cx from 'classnames';
                                  import { Text } from 'preact-i18n';
                                  import Hls from 'hls.js';
                                  Severity: Minor
                                  Found in front/src/components/boxs/camera/Camera.jsx - About 3 hrs to fix

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

                                      render(props, { loading, error }) {
                                        return (
                                          <Layout>
                                            <div class="container mt-4">
                                              <div class="row">
                                    Severity: Major
                                    Found in front/src/routes/integration/all/google-home-gateway/index.js - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language