appbaseio/reactivesearch

View on GitHub
packages/vue/src/components/range/MultiRange.jsx

Summary

Maintainability
F
4 days
Test Coverage

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

    render() {
        return (
            <Container class={this.$props.className}>
                {this.$props.title && (
                    <Title class={getClassName(this.$props.innerClass, 'title')}>
Severity: Minor
Found in packages/vue/src/components/range/MultiRange.jsx - About 1 hr to fix

    Function selectItem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            selectItem(item, isDefaultValue = false, props = this.$props) {
                // ignore state updates when component is locked
                if (props.beforeValueChange && this.locked) {
                    return;
                }
    Severity: Minor
    Found in packages/vue/src/components/range/MultiRange.jsx - About 1 hr to fix

      Function selectItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              selectItem(item, isDefaultValue = false, props = this.$props) {
                  // ignore state updates when component is locked
                  if (props.beforeValueChange && this.locked) {
                      return;
                  }
      Severity: Minor
      Found in packages/vue/src/components/range/MultiRange.jsx - About 25 mins 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

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

          props: {
              beforeValueChange: types.func,
              className: VueTypes.string.def(''),
              componentId: types.stringRequired,
              customQuery: types.func,
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 1 other location - About 6 hrs to fix
      packages/vue/src/components/range/SingleRange.jsx on lines 22..37

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

      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

      MultiRange.defaultQuery = (values, props) => {
          const generateRangeQuery = (dataField, items) => {
              if (items.length > 0) {
                  return items.map(value => ({
                      range: {
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 1 other location - About 5 hrs to fix
      packages/native/src/components/range/MultiDropdownRange.js on lines 85..112

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

      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

                  } else if (isDefaultValue) {
                      currentValue = MultiRange.parseValue(item, props);
                      currentValue.forEach(value => {
                          selectedValues = { ...selectedValues, [value.label]: true };
                      });
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 1 other location - About 4 hrs to fix
      packages/web/src/components/range/MultiRange.js on lines 135..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 125.

      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

          watch: {
              react() {
                  this.setReact(this.$props);
              },
              dataField() {
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 1 other location - About 4 hrs to fix
      packages/vue/src/components/range/SingleRange.jsx on lines 58..73

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

      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

              updateQueryHandler(value, props) {
                  const query = props.customQuery || MultiRange.defaultQuery;
                  this.updateQuery({
                      componentId: props.componentId,
                      query: query(value, props),
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 5 other locations - About 3 hrs to fix
      packages/vue/src/components/list/MultiDropdownList.jsx on lines 302..313
      packages/vue/src/components/list/MultiList.jsx on lines 333..344
      packages/vue/src/components/list/SingleDropdownList.jsx on lines 239..250
      packages/vue/src/components/list/SingleList.jsx on lines 280..291
      packages/vue/src/components/range/SingleRange.jsx on lines 145..156

      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

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

                                      <label
                                          class={getClassName(this.$props.innerClass, 'label')}
                                          for={`${this.$props.componentId}-${item.label}`}
                                      >
                                          {item.label}
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 1 other location - About 1 hr to fix
      packages/vue/src/components/range/SingleRange.jsx on lines 100..105

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

      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

              if (this.selectedValue) {
                  this.selectItem(this.selectedValue, true);
              } else if (this.$props.defaultSelected) {
                  this.selectItem(this.$props.defaultSelected, true);
              }
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 2 other locations - About 1 hr to fix
      packages/vue/src/components/list/MultiDropdownList.jsx on lines 85..89
      packages/vue/src/components/search/DataSearch.jsx on lines 120..124

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

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

          created() {
              const onQueryChange = (...args) => {
                  this.$emit('queryChange', ...args);
              };
              this.setQueryListener(this.$props.componentId, onQueryChange, null);
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 6 other locations - About 1 hr to fix
      packages/vue/src/components/list/MultiDropdownList.jsx on lines 72..77
      packages/vue/src/components/list/MultiList.jsx on lines 69..74
      packages/vue/src/components/list/SingleDropdownList.jsx on lines 70..75
      packages/vue/src/components/list/SingleList.jsx on lines 67..72
      packages/vue/src/components/range/RangeSlider.jsx on lines 125..130
      packages/vue/src/components/range/SingleRange.jsx on lines 38..43

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

      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

                      {this.$props.title && (
                          <Title class={getClassName(this.$props.innerClass, 'title')}>
                              {this.$props.title}
                          </Title>
                      )}
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 3 other locations - About 1 hr to fix
      packages/vue/src/components/list/MultiList.jsx on lines 149..153
      packages/vue/src/components/range/RangeSlider.jsx on lines 156..160
      packages/vue/src/components/range/SingleRange.jsx on lines 78..82

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

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

      const mapStateToProps = (state, props) => ({
          selectedValue:
              (state.selectedValues[props.componentId]
                  && state.selectedValues[props.componentId].value)
              || null,
      Severity: Major
      Found in packages/vue/src/components/range/MultiRange.jsx and 8 other locations - About 55 mins to fix
      packages/native/src/components/basic/DataController.js on lines 103..108
      packages/native/src/components/basic/TextField.js on lines 239..244
      packages/native/src/components/range/SingleDropdownRange.js on lines 184..189
      packages/vue/src/components/range/SingleRange.jsx on lines 181..186
      packages/web/src/components/basic/DataController.js on lines 112..117
      packages/web/src/components/basic/ToggleButton.js on lines 252..257
      packages/web/src/components/range/RatingsFilter.js on lines 218..223
      packages/web/src/components/range/SingleRange.js on lines 220..225

      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

      There are no issues that match your filters.

      Category
      Status