GladysProject/Gladys

View on GitHub

Showing 2,690 of 2,690 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    return (
      <RoomTemperatureBox
        {...props}
        temperature={temperature}
        unit={unit}
front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 102..113

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  'post /api/v1/user': {
    id: '215811c9-c0aa-4148-8a4b-e02892d7446f',
    firstname: 'tony',
    lastname: 'Stark',
    email: 'tony.stark@gladysassistant.com',
Severity: Major
Found in front/src/config/demo.js and 2 other locations - About 1 hr to fix
front/src/config/demo.js on lines 4..18
front/src/config/demo.js on lines 65..79

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const EditEweLinkDevice = props => (
  <EweLinkPage user={props.user}>
    <UpdateDevice
      {...props}
      integrationName="ewelink"
front/src/routes/integration/all/melcloud/edit-page/index.js on lines 5..14
front/src/routes/integration/all/tuya/edit-page/index.js on lines 5..14

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.addColumn('t_session', 'useragent', {
      type: Sequelize.TEXT,
    });
Severity: Major
Found in server/migrations/20200513195013-session-with-useragent.js and 1 other location - About 1 hr to fix
server/migrations/20230511161620-description-scene.js on lines 1..8

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                      <span class="input-icon-addon cursor-pointer" onClick={this.togglePassword}>
                        <i
                          class={cx('fe', {
                            'fe-eye': !showPassword,
                            'fe-eye-off': showPassword
front/src/routes/integration/all/mqtt/setup-page/SetupForm.jsx on lines 100..107
front/src/routes/integration/all/node-red/setup-page/SetupTab.jsx on lines 248..255
front/src/routes/integration/all/zigbee2mqtt/setup-page/remote/SetupRemoteOptions.jsx on lines 119..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    getBoxStatus(state, key, x, y) {
      // we refresh the state the be sure we have the latest state
      const currentState = store.getState();
      // we get the current box data and return it
      return get(currentState, `${DASHBOARD_BOX_STATUS_KEY}${key}.${x}_${y}`);
Severity: Major
Found in front/src/actions/dashboard/boxActions.js and 1 other location - About 1 hr to fix
front/src/actions/dashboard/boxActions.js on lines 51..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.addColumn('t_scene', 'description', {
      type: Sequelize.STRING,
    });
Severity: Major
Found in server/migrations/20230511161620-description-scene.js and 1 other location - About 1 hr to fix
server/migrations/20200513195013-session-with-useragent.js on lines 1..8

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            {!props.gatewayLoginStep2 && (
              <button
                onClick={props.login}
                class="btn btn-primary btn-block"
                disabled={props.gatewayLoginStatus === RequestStatus.Getting}
Severity: Major
Found in front/src/components/gateway/GatewayLoginForm.jsx and 1 other location - About 1 hr to fix
front/src/components/gateway/GatewayLoginForm.jsx on lines 117..125

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            {props.gatewayLoginStep2 && (
              <button
                onClick={props.loginTwoFactor}
                class="btn btn-primary btn-block"
                disabled={props.gatewayLoginStatus === RequestStatus.Getting}
Severity: Major
Found in front/src/components/gateway/GatewayLoginForm.jsx and 1 other location - About 1 hr to fix
front/src/components/gateway/GatewayLoginForm.jsx on lines 108..116

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 61.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  up: async (queryInterface, Sequelize) => {
    const service = await db.Service.findOne({
      where: {
        name: 'enedis',
      },
Severity: Minor
Found in server/migrations/20230414020652-enedis-unit-is-watt-hour.js - About 1 hr to fix

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

    async function connect() {
      this.configured = false;
      this.connected = false;
    
      const email = await this.gladys.variable.getValue(EWELINK_EMAIL_KEY, this.serviceId);
    Severity: Minor
    Found in server/services/ewelink/lib/device/connect.js - About 1 hr to fix

      Function cancelLearn has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function cancelLearn(peripheralIdentifier) {
        logger.debug(`Broalink leaving learn mode with ${peripheralIdentifier}`);
      
        clearTimeout(this.learnTimers[peripheralIdentifier]);
      
      
      Severity: Minor
      Found in server/services/broadlink/lib/learn/broadlink.cancelLearn.js - About 1 hr to fix

        Function sendToUser has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function sendToUser(userSelector, text, file = null) {
          const user = this.state.get('user', userSelector);
          if (user === null) {
            throw new NotFoundError(`User ${userSelector} not found`);
          }
        Severity: Minor
        Found in server/lib/message/message.sendToUser.js - About 1 hr to fix

          Function deleteHouse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async deleteHouse(state, houseIndex) {
                store.setState({
                  houseUpdateStatus: RequestStatus.Getting
                });
                const house = state.houses[houseIndex];
          Severity: Minor
          Found in front/src/actions/house.js - About 1 hr to fix

            Function init has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function init(startDeviceStateAggregate = true) {
              // load all devices in RAM
              const devices = await db.Device.findAll({
                include: [
                  {
            Severity: Minor
            Found in server/lib/device/device.init.js - About 1 hr to fix

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

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

                Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

                    render(props, {}) {
                      return (
                        <SettingsLayout currentUrl={props.currentUrl}>
                          {props.newUser && (
                            <CreateUserPage
                  Severity: Minor
                  Found in front/src/routes/settings/settings-users/create-user/index.js - About 1 hr to fix

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

                      render(props, { loading, tooMuchStatesError, statesNumber }) {
                        return (
                          <div class="col-md-6">
                            <div class="card">
                              <div class="card-header">{props.device.name || <Text id="integration.mqtt.device.noNameLabel" />}</div>
                    Severity: Minor
                    Found in front/src/routes/integration/all/philips-hue/device-page/Device.jsx - About 1 hr to fix

                      Function updateFeatureProperty has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        updateFeatureProperty(e, property, featureIndex) {
                          let value = e.target.value;
                          let device;
                          if (property === 'external_id' && !value.startsWith('mqtt:')) {
                            if (value.length < 5) {
                      Severity: Minor
                      Found in front/src/routes/integration/all/mqtt/device-page/setup/index.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language