GladysProject/Gladys

View on GitHub
front/src/components/boxs/room-humidity/RoomHumidity.jsx

Summary

Maintainability
C
1 day
Test Coverage

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

  render(props, {}) {
    const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}HumidityInRoom.${props.x}_${props.y}`);
    const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}HumidityInRoom.${props.x}_${props.y}`);
    const humidity = get(boxData, 'room.humidity.humidity');
    const unit = get(boxData, 'room.humidity.unit');
Severity: Minor
Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx - About 1 hr to fix

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

          {isNotNullOrUndefined(props.humidity) &&
            props.humidity >= props.humidityMin &&
            props.humidity <= props.humidityMax && (
              <span class="stamp stamp-md bg-green mr-3">
                <i class="fe fe-droplet" />
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 1 other location - About 2 hrs to fix
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 20..26

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

    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

        return (
          <RoomHumidityBox
            {...props}
            humidity={humidity}
            unit={unit}
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 1 other location - About 1 hr to fix
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 114..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 4 locations. Consider refactoring.
    Open

          {isNotNullOrUndefined(props.humidity) && props.humidity > props.humidityMax && (
            <span class="stamp stamp-md bg-blue mr-3">
              <i class="fe fe-droplet" />
            </span>
          )}
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 3 other locations - About 1 hr to fix
    front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 22..26
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 27..31
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 32..36

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

    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

          {isNotNullOrUndefined(props.humidity) && props.humidity < props.humidityMin && (
            <span class="stamp stamp-md bg-yellow mr-3">
              <i class="fe fe-droplet" />
            </span>
          )}
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 3 other locations - About 1 hr to fix
    front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 27..31
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 27..31
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 32..36

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

    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 6 locations. Consider refactoring.
    Open

      componentDidMount() {
        this.refreshData();
        this.props.session.dispatcher.addListener(WEBSOCKET_MESSAGE_TYPES.DEVICE.NEW_STATE, this.updateRoomHumidity);
      }
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 5 other locations - About 55 mins to fix
    front/src/components/boxs/chart/Chart.jsx on lines 241..247
    front/src/components/boxs/music/MusicBox.jsx on lines 89..95
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 70..73
    front/src/routes/integration/all/zwavejs-ui/discover-page/DiscoverTab.jsx on lines 46..52
    front/src/routes/locked/index.js on lines 146..149

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

    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

      updateRoomHumidity = payload => {
        this.props.deviceFeatureWebsocketEvent(this.props.box, this.props.x, this.props.y, payload);
      };
    Severity: Minor
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 1 other location - About 55 mins to fix
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 66..68

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

    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

      componentDidUpdate(previousProps) {
        const roomChanged = get(previousProps, 'box.room') !== get(this.props, 'box.room');
        if (roomChanged) {
          this.refreshData();
        }
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 3 other locations - About 50 mins to fix
    front/src/components/boxs/device-in-room/DevicesBox.jsx on lines 185..190
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 75..80
    front/src/components/boxs/user-presence/UserPresence.jsx on lines 164..169

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

    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

      refreshData = () => {
        this.props.getHumidityInRoom(this.props.box, this.props.x, this.props.y);
      };
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 2 other locations - About 50 mins to fix
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 62..64
    front/src/components/boxs/weather/WeatherBox.jsx on lines 216..218

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

    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

            {!isNotNullOrUndefined(props.humidity) && (
              <p class="m-0">
                <Text id="dashboard.boxes.humidityInRoom.noHumidityRecorded" />
              </p>
            )}
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 3 other locations - About 35 mins to fix
    front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 32..36
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 37..41
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 50..54

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

    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

          {!isNotNullOrUndefined(props.humidity) && (
            <span class="stamp stamp-md bg-warning mr-3">
              <i class="fe fe-droplet" />
            </span>
          )}
    Severity: Major
    Found in front/src/components/boxs/room-humidity/RoomHumidity.jsx and 3 other locations - About 35 mins to fix
    front/src/components/boxs/room-humidity/RoomHumidity.jsx on lines 43..47
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 37..41
    front/src/components/boxs/room-temperature/RoomTemperature.jsx on lines 50..54

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

    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

    There are no issues that match your filters.

    Category
    Status