GladysProject/Gladys

View on GitHub
front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx

Summary

Maintainability
F
6 days
Test Coverage

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

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

    File CalendarIsEventRunning.jsx has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Select from 'react-select';
    import { Component } from 'preact';
    import { connect } from 'unistore/preact';
    import { RequestStatus } from '../../../../utils/consts';
    import { Text, Localizer } from 'preact-i18n';
    Severity: Minor
    Found in front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx - About 2 hrs to fix

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

              <div class="row">
                <div class="col-sm-4">
                  <div class="form-group">
                    <div class="form-label">
                      <Text id="editScene.actionsCard.calendarEventIsRunning.nameLabel" />
      front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx on lines 187..229

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

      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

        getCalendars = async () => {
          this.setState({
            status: RequestStatus.Getting
          });
          try {
      front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx on lines 16..38

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

      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

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

          this.props.setVariables(columnIndex, index, [
            {
              name: 'calendarEvent.name',
              type: 'calendar',
              ready: true,
      front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx on lines 94..130

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

      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

              <div class="row">
                <div class="col-md-12">
                  <div class="form-group">
                    <div class="form-label">
                      <Text id="editScene.actionsCard.calendarEventIsRunning.calendarLabel" />
      front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx on lines 171..186

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

      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

          if (action.calendars && this.state.calendarsOptions) {
            action.calendars.forEach(calendar => {
              const calendarOption = this.state.calendarsOptions.find(calendarOption => calendarOption.value === calendar);
              if (calendarOption) {
                selectedCalendarsOptions.push(calendarOption);
      front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx on lines 77..84

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

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

              <div class="row">
                <div class="col-md-12">
                  <p>
                    <Text id="editScene.actionsCard.calendarEventIsRunning.description" />
                  </p>
      front/src/routes/gateway-reset-password/ResetPassword.js on lines 42..48
      front/src/routes/scene/edit-scene/triggers/CalendarEventIsComing.jsx on lines 164..170
      front/src/routes/settings/settings-gateway/GatewayPricing.jsx on lines 12..18
      front/src/routes/settings/settings-gateway/GatewayPricing.jsx on lines 29..35

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

          if (isNullOrUndefined(get(this.props, 'action.calendar_event_name_comparator'))) {
            this.props.updateActionProperty(
              this.props.columnIndex,
              this.props.index,
              'calendar_event_name_comparator',
      front/src/routes/scene/edit-scene/actions/EcowattCondition.jsx on lines 14..16
      front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 32..34
      front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 35..37
      front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 38..45

      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

          if (isNullOrUndefined(get(this.props, 'action.stop_scene_if_event_not_found'))) {
            this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'stop_scene_if_event_not_found', true);
          }
      front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx on lines 108..110

      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

          if (isNullOrUndefined(get(this.props, 'action.stop_scene_if_event_found'))) {
            this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'stop_scene_if_event_found', false);
          }
      front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx on lines 111..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 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 11 locations. Consider refactoring.
      Open

        handleNameChange = e => {
          this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'calendar_event_name', e.target.value);
        };
      front/src/routes/integration/all/ewelink/EweLinkDeviceBox.jsx on lines 11..13
      front/src/routes/integration/all/ewelink/EweLinkDeviceBox.jsx on lines 15..17
      front/src/routes/scene/edit-scene/actions/BlinkLightParams.jsx on lines 36..38
      front/src/routes/scene/edit-scene/actions/DelayActionParams.jsx on lines 10..12
      front/src/routes/scene/edit-scene/actions/EcowattCondition.jsx on lines 9..11
      front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 9..11
      front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 13..20
      front/src/routes/scene/edit-scene/actions/EdfTempoCondition.jsx on lines 22..29
      front/src/routes/scene/edit-scene/actions/HttpRequest.jsx on lines 100..102
      front/src/routes/scene/edit-scene/actions/SendMqttMessage.jsx on lines 13..15

      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

      There are no issues that match your filters.

      Category
      Status