appbaseio/reactivesearch

View on GitHub
packages/web/src/components/shared/Dropdown.js

Summary

Maintainability
F
4 days
Test Coverage

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

    render() {
        const {
            items,
            selectedItem,
            placeholder,
Severity: Major
Found in packages/web/src/components/shared/Dropdown.js - About 5 hrs to fix

    Avoid too many return statements within this function.
    Open

            return value;
    Severity: Major
    Found in packages/web/src/components/shared/Dropdown.js - About 30 mins to fix

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

          renderToString = (value) => {
              if (Array.isArray(value) && value.length) {
                  const arrayToRender = value.map(item => this.renderToString(item));
                  return arrayToRender.join(', ');
              } else if (value && typeof value === 'object') {
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 6 hrs to fix
      packages/vue/src/components/shared/DropDown.jsx on lines 246..261

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

      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

      Dropdown.propTypes = {
          innerClass: types.style,
          items: types.data,
          keyField: types.string,
          labelField: types.string,
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 6 hrs to fix
      packages/web/src/components/basic/ReactiveBase.js on lines 145..163

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

      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

                                      {this.props.showSearch ? (
                                          <Input
                                              id={`${this.props.componentId}-input`}
                                              style={{
                                                  border: 0,
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 4 hrs to fix
      packages/vue/src/components/shared/DropDown.jsx on lines 98..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 130.

      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

                                      {itemsToRender
                                          .filter((item) => {
                                              if (String(item[labelField]).length) {
                                                  if (this.props.showSearch && this.state.searchTerm) {
                                                      return String(item[labelField])
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 5 other locations - About 3 hrs to fix
      packages/vue/src/components/list/MultiList.jsx on lines 183..240
      packages/vue/src/components/list/SingleList.jsx on lines 169..232
      packages/vue/src/components/shared/DropDown.jsx on lines 113..194
      packages/web/src/components/list/MultiList.js on lines 413..466
      packages/web/src/components/list/SingleList.js on lines 323..377

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

      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

                                              let selected
                                                  = this.props.multi
                                                  // MultiDropdownList
                                                  && ((selectedItem && !!selectedItem[item[keyField]])
                                                      // MultiDropdownRange
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 2 hrs to fix
      packages/vue/src/components/shared/DropDown.jsx on lines 128..134

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

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

          handleStateChange = (changes) => {
              const { isOpen, type } = changes;
              if (type === Downshift.stateChangeTypes.mouseUp) {
                  this.setState({
                      isOpen,
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 4 other locations - About 1 hr to fix
      packages/maps/src/components/basic/GeoDistanceDropdown.js on lines 354..361
      packages/maps/src/components/basic/GeoDistanceSlider.js on lines 356..363
      packages/web/src/components/search/CategorySearch.js on lines 434..441
      packages/web/src/components/search/DataSearch.js on lines 388..395

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

      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

          getBackgroundColor = (highlighted, selected) => {
              const isDark = this.props.themePreset === 'dark';
              if (highlighted) {
                  return isDark ? '#555' : '#eee';
              } else if (selected) {
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 1 hr to fix
      packages/vue/src/components/shared/DropDown.jsx on lines 229..239

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

      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 (this.props.returnsObject) {
                  this.props.onChange(item);
              } else {
                  this.props.onChange(item[this.props.keyField]);
              }
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 1 hr to fix
      packages/vue/src/components/shared/DropDown.jsx on lines 215..219

      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

                              <Select
                                  {...getButtonProps()}
                                  className={getClassName(this.props.innerClass, 'select') || null}
                                  onClick={this.toggle}
                                  title={selectedItem ? this.renderToString(selectedItem) : placeholder}
      Severity: Minor
      Found in packages/web/src/components/shared/Dropdown.js and 1 other location - About 40 mins to fix
      packages/vue/src/components/shared/DropDown.jsx on lines 70..91

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

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

          handleInputChange = (e) => {
              const { value } = e.target;
              this.setState({
                  searchTerm: value,
              });
      Severity: Major
      Found in packages/web/src/components/shared/Dropdown.js and 4 other locations - About 30 mins to fix
      packages/web/src/components/list/MultiDataList.js on lines 302..307
      packages/web/src/components/list/MultiList.js on lines 328..333
      packages/web/src/components/list/SingleDataList.js on lines 220..225
      packages/web/src/components/list/SingleList.js on lines 235..240

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

      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