GladysProject/Gladys

View on GitHub
front/src/routes/integration/all/broadlink/remote-page/RemoteFeatureEditionPanel.jsx

Summary

Maintainability
D
2 days
Test Coverage

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

  render(
    { selectedFeature, selectedValue, learnAllMode, editedFeatures, device, learning, ...props },
    { timeLeft, errorKey }
  ) {
    const { model: category } = device;

    File RemoteFeatureEditionPanel.jsx has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Component } from 'preact';
    import { MarkupText, Text, translate } from 'preact-i18n';
    
    import { WEBSOCKET_MESSAGE_TYPES } from '../../../../../../../server/utils/constants';
    
    

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

                <div>
                  <div class="alert alert-info">
                    <Text id="integration.broadlink.setup.selectFeatureLabel" />
                  </div>
                  <div class="d-flex justify-content-center">
      front/src/routes/integration/all/philips-hue/setup-page/SetupTab.jsx on lines 25..34

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

      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

          try {
            await this.props.httpClient.post('/api/v1/service/broadlink/learn/cancel', {
              peripheral
            });
            this.setState({
      front/src/routes/integration/all/broadlink/remote-page/RemoteFeatureEditionPanel.jsx on lines 71..83

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

      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

          try {
            await this.props.httpClient.post('/api/v1/service/broadlink/learn', {
              peripheral
            });
            this.setState({
      front/src/routes/integration/all/broadlink/remote-page/RemoteFeatureEditionPanel.jsx on lines 99..111

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

      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

                  {hasActions && !hasSelectedValue && (
                    <div class="alert alert-info">
                      <MarkupText
                        id="integration.broadlink.setup.unselectedActionInfoLabel"
                        fields={{ feature: <Text id={`deviceFeatureCategory.${category}.${selectedFeature}`} /> }}
      front/src/routes/integration/all/broadlink/remote-page/RemoteFeatureEditionPanel.jsx on lines 234..241

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

      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

                  {!hasActions && (
                    <div class="alert alert-info">
                      <MarkupText
                        id="integration.broadlink.setup.selectedFeatureInfoLabel"
                        fields={{ feature: <Text id={`deviceFeatureCategory.${category}.${selectedFeature}`} /> }}
      front/src/routes/integration/all/broadlink/remote-page/RemoteFeatureEditionPanel.jsx on lines 245..252

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

      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