appbaseio/reactivesearch

View on GitHub
packages/web/src/components/search/DataSearch.js

Summary

Maintainability
F
1 wk
Test Coverage

File DataSearch.js has 622 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from 'react';
import Downshift from 'downshift';
import { withTheme } from 'emotion-theming';

import {
Severity: Major
Found in packages/web/src/components/search/DataSearch.js - About 1 day to fix

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

        render() {
            let suggestionsList = [];
    
            if (
                !this.state.currentValue
    Severity: Major
    Found in packages/web/src/components/search/DataSearch.js - About 4 hrs to fix

      DataSearch has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class DataSearch extends Component {
          constructor(props) {
              super(props);
      
              this.state = {
      Severity: Minor
      Found in packages/web/src/components/search/DataSearch.js - About 3 hrs to fix

        Function componentWillReceiveProps has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            componentWillReceiveProps(nextProps) {
                checkSomePropChange(
                    this.props,
                    nextProps,
                    ['highlight', 'dataField', 'highlightField'],
        Severity: Minor
        Found in packages/web/src/components/search/DataSearch.js - About 1 hr to fix

          Function performUpdate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  const performUpdate = () => {
                      this.setState(
                          {
                              currentValue: value,
                              suggestions: [],
          Severity: Minor
          Found in packages/web/src/components/search/DataSearch.js - About 1 hr to fix

            Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                render() {
                    let suggestionsList = [];
            
                    if (
                        !this.state.currentValue
            Severity: Minor
            Found in packages/web/src/components/search/DataSearch.js - About 35 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

            Function componentWillReceiveProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                componentWillReceiveProps(nextProps) {
                    checkSomePropChange(
                        this.props,
                        nextProps,
                        ['highlight', 'dataField', 'highlightField'],
            Severity: Minor
            Found in packages/web/src/components/search/DataSearch.js - About 35 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 3 locations. Consider refactoring.
            Open

                static shouldQuery = (value, dataFields, props) => {
                    const fields = dataFields.map((field, index) =>
                        `${field}${
                            Array.isArray(props.fieldWeights) && props.fieldWeights[index]
                                ? `^${props.fieldWeights[index]}`
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 1 day to fix
            packages/native/src/components/search/DataSearch.js on lines 169..219
            packages/web/src/components/search/CategorySearch.js on lines 230..280

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

            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

                static highlightQuery = (props) => {
                    if (props.customHighlight) {
                        return props.customHighlight(props);
                    }
                    if (!props.highlight) {
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 7 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 156..181

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

            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

                renderIcons = () => (
                    <div>
                        {this.state.currentValue
                            && this.props.showClear && (
                            <InputIcon
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 5 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 472..490

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

            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

                                                {...getInputProps({
                                                    className: getClassName(this.props.innerClass, 'input'),
                                                    placeholder: this.props.placeholder,
                                                    value:
                                                        this.state.currentValue === null
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 5 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 590..603

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

            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

                renderLoader = () => {
                    const {
                        loader, isLoading, themePreset, theme,
                    } = this.props;
                    const { currentValue } = this.state;
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 5 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 492..510

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

            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

                onSuggestions = (results) => {
                    if (this.props.onSuggestion) {
                        return results.map(suggestion => this.props.onSuggestion(suggestion));
                    }
            
            
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 4 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 282..292

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

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

                    if (this.props.defaultSelected !== nextProps.defaultSelected) {
                        this.setValue(nextProps.defaultSelected, true, nextProps);
                    } else if (
                        // since, selectedValue will be updated when currentValue changes,
                        // we must only check for the changes introduced by
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 3 hrs to fix
            packages/web/src/components/basic/TextField.js on lines 57..68
            packages/web/src/components/search/CategorySearch.js on lines 115..126

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

            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.highlight) {
                        const queryOptions = DataSearch.highlightQuery(this.props) || {};
                        queryOptions.size = 20;
                        this.props.setQueryOptions(this.props.componentId, queryOptions);
                    } else {
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 3 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 62..70

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

            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

                constructor(props) {
                    super(props);
            
                    this.state = {
                        currentValue: '',
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 3 hrs to fix
            packages/web/src/components/search/CategorySearch.js on lines 45..56

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

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

                    if (Array.isArray(nextProps.suggestions) && this.state.currentValue.trim().length) {
                        // shallow check allows us to set suggestions even if the next set
                        // of suggestions are same as the current one
                        if (this.props.suggestions !== nextProps.suggestions) {
                            this.setState({
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 3 hrs to fix
            packages/native/src/components/search/DataSearch.js on lines 77..85
            packages/web/src/components/search/CategorySearch.js on lines 96..104

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

                setReact = (props) => {
                    const { react } = props;
                    if (react) {
                        const newReact = pushToAndClause(react, this.internalComponent);
                        props.watchComponent(props.componentId, newReact);
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 14 other locations - About 2 hrs to fix
            packages/maps-native/src/components/maps/ReactiveMap.js on lines 215..223
            packages/maps/src/components/result/ReactiveMap.js on lines 350..358
            packages/native/src/components/list/MultiDropdownList.js on lines 99..107
            packages/native/src/components/list/SingleDropdownList.js on lines 83..91
            packages/native/src/components/range/RangeSlider.js on lines 110..118
            packages/native/src/components/result/ReactiveList.js on lines 241..249
            packages/native/src/components/search/DataSearch.js on lines 108..116
            packages/web/src/components/basic/TagCloud.js on lines 97..107
            packages/web/src/components/list/MultiDropdownList.js on lines 123..133
            packages/web/src/components/list/MultiList.js on lines 117..127
            packages/web/src/components/list/SingleDropdownList.js on lines 112..122
            packages/web/src/components/list/SingleList.js on lines 108..118
            packages/web/src/components/range/RangeSlider.js on lines 115..125
            packages/web/src/components/search/CategorySearch.js on lines 144..154

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

                    if (
                        !this.state.currentValue
                        && this.props.defaultSuggestions
                        && this.props.defaultSuggestions.length
                    ) {
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 2 hrs to fix
            packages/native/src/components/search/DataSearch.js on lines 302..310
            packages/web/src/components/search/CategorySearch.js on lines 525..533

            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

                                    if (props.strictSelection) {
                                        if (cause === causes.SUGGESTION_SELECT || value === '') {
                                            this.updateQuery(props.componentId, value, props);
                                        } else {
                                            this.setValue('', true);
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 2 hrs to fix
            packages/vue/src/components/search/DataSearch.jsx on lines 235..243

            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

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

                handleTextChange = debounce((value) => {
                    if (this.props.autosuggest) {
                        this.updateQuery(this.internalComponent, value, this.props);
                    } else {
                        this.updateQuery(this.props.componentId, value, this.props);
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 2 hrs to fix
            packages/native/src/components/search/DataSearch.js on lines 248..254
            packages/web/src/components/search/CategorySearch.js on lines 338..344

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

            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

                    if (value) {
                        if (Array.isArray(props.dataField)) {
                            fields = props.dataField;
                        } else {
                            fields = [props.dataField];
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 2 hrs to fix
            packages/vue/src/components/search/DataSearch.jsx on lines 545..557

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

            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

                    checkSomePropChange(
                        this.props,
                        nextProps,
                        ['highlight', 'dataField', 'highlightField'],
                        () => {
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 1 hr to fix
            packages/web/src/components/search/CategorySearch.js on lines 83..92

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

            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

                onInputChange = (e) => {
                    const { value } = e.target;
                    if (!this.state.isOpen) {
                        this.setState({
                            isOpen: true,
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 1 hr to fix
            packages/web/src/components/search/CategorySearch.js on lines 401..409

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

            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

                                                        <li
                                                            {...getItemProps({ item })}
                                                            key={`${index + 1}-${item.value}`}
                                                            style={{
                                                                backgroundColor: this.getBackgroundColor(
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 1 hr to fix
            packages/web/src/components/search/CategorySearch.js on lines 626..637

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

            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/search/DataSearch.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/shared/Dropdown.js on lines 48..55
            packages/web/src/components/search/CategorySearch.js on lines 434..441

            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

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

                getBackgroundColor = (highlightedIndex, index) => {
                    const isDark = this.props.themePreset === 'dark';
                    if (isDark) {
                        return highlightedIndex === index ? '#555' : '#424242';
                    }
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 1 hr to fix
            packages/web/src/components/search/CategorySearch.js on lines 443..449

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

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

                            {this.props.title && (
                                <Title className={getClassName(this.props.innerClass, 'title') || null}>
                                    {this.props.title}
                                </Title>
                            )}
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 22 other locations - About 1 hr to fix
            packages/maps/src/components/basic/GeoDistanceDropdown.js on lines 447..451
            packages/maps/src/components/basic/GeoDistanceSlider.js on lines 455..459
            packages/web/src/components/basic/NumberBox.js on lines 170..174
            packages/web/src/components/basic/TagCloud.js on lines 247..251
            packages/web/src/components/basic/TextField.js on lines 175..179
            packages/web/src/components/basic/ToggleButton.js on lines 191..195
            packages/web/src/components/date/DatePicker.js on lines 173..177
            packages/web/src/components/date/DateRange.js on lines 305..309
            packages/web/src/components/list/MultiDataList.js on lines 341..345
            packages/web/src/components/list/MultiDropdownList.js on lines 346..350
            packages/web/src/components/list/MultiList.js on lines 384..388
            packages/web/src/components/list/SingleDataList.js on lines 259..263
            packages/web/src/components/list/SingleDropdownList.js on lines 252..256
            packages/web/src/components/list/SingleList.js on lines 291..295
            packages/web/src/components/range/DynamicRangeSlider.js on lines 404..408
            packages/web/src/components/range/MultiDropdownRange.js on lines 187..191
            packages/web/src/components/range/MultiRange.js on lines 194..198
            packages/web/src/components/range/RangeSlider.js on lines 289..293
            packages/web/src/components/range/RatingsFilter.js on lines 155..159
            packages/web/src/components/range/SingleDropdownRange.js on lines 148..152
            packages/web/src/components/range/SingleRange.js on lines 148..152
            packages/web/src/components/search/CategorySearch.js on lines 568..572

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

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

                handleFocus = (event) => {
                    this.setState({
                        isOpen: true,
                    });
                    if (this.props.onFocus) {
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 3 other locations - About 1 hr to fix
            packages/maps/src/components/basic/GeoDistanceDropdown.js on lines 341..348
            packages/maps/src/components/basic/GeoDistanceSlider.js on lines 343..350
            packages/web/src/components/search/CategorySearch.js on lines 376..383

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

                onSuggestionSelected = (suggestion) => {
                    this.setValue(suggestion.value, true, this.props, causes.SUGGESTION_SELECT);
                    this.onValueSelected(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
                };
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 1 hr to fix
            packages/vue/src/components/search/DataSearch.jsx on lines 324..336

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

            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

                handleSearchIconClick = () => {
                    const { currentValue } = this.state;
                    if (currentValue.trim()) {
                        this.setValue(currentValue, true);
                    }
            Severity: Minor
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 55 mins to fix
            packages/web/src/components/search/CategorySearch.js on lines 451..456

            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

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

                                    if (this.props.autosuggest) {
                                        this.setState({
                                            isOpen: false,
                                        });
                                        this.updateQuery(this.internalComponent, value, props);
            Severity: Minor
            Found in packages/web/src/components/search/DataSearch.js and 1 other location - About 50 mins to fix
            packages/web/src/components/search/CategorySearch.js on lines 309..314

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

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

                componentWillUnmount() {
                    this.props.removeComponent(this.props.componentId);
                    this.props.removeComponent(this.internalComponent);
                }
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 15 other locations - About 45 mins to fix
            packages/maps-native/src/components/maps/ReactiveMap.js on lines 210..213
            packages/maps/src/components/result/ReactiveMap.js on lines 345..348
            packages/native/src/components/list/MultiDropdownList.js on lines 94..97
            packages/native/src/components/list/SingleDropdownList.js on lines 78..81
            packages/native/src/components/range/RangeSlider.js on lines 105..108
            packages/native/src/components/search/DataSearch.js on lines 103..106
            packages/web/src/components/basic/TagCloud.js on lines 92..95
            packages/web/src/components/list/MultiDataList.js on lines 100..103
            packages/web/src/components/list/MultiDropdownList.js on lines 118..121
            packages/web/src/components/list/MultiList.js on lines 112..115
            packages/web/src/components/list/SingleDataList.js on lines 88..91
            packages/web/src/components/list/SingleDropdownList.js on lines 107..110
            packages/web/src/components/list/SingleList.js on lines 103..106
            packages/web/src/components/range/RangeSlider.js on lines 110..113
            packages/web/src/components/search/CategorySearch.js on lines 129..132

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

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

                renderIcon = () => {
                    if (this.props.showIcon) {
                        return this.props.icon || <SearchSvg />;
                    }
                    return null;
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 6 other locations - About 40 mins to fix
            packages/maps/src/components/basic/GeoDistanceDropdown.js on lines 291..296
            packages/maps/src/components/basic/GeoDistanceSlider.js on lines 297..302
            packages/web/src/components/basic/TextField.js on lines 155..160
            packages/web/src/components/search/CategorySearch.js on lines 458..463
            packages/web/src/components/search/CategorySearch.js on lines 465..470
            packages/web/src/components/search/DataSearch.js on lines 419..424

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

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

                renderCancelIcon = () => {
                    if (this.props.showClear) {
                        return this.props.clearIcon || <CancelSvg />;
                    }
                    return null;
            Severity: Major
            Found in packages/web/src/components/search/DataSearch.js and 6 other locations - About 40 mins to fix
            packages/maps/src/components/basic/GeoDistanceDropdown.js on lines 291..296
            packages/maps/src/components/basic/GeoDistanceSlider.js on lines 297..302
            packages/web/src/components/basic/TextField.js on lines 155..160
            packages/web/src/components/search/CategorySearch.js on lines 458..463
            packages/web/src/components/search/CategorySearch.js on lines 465..470
            packages/web/src/components/search/DataSearch.js on lines 412..417

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

            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 (event.key === 'Enter' && highlightedIndex === null) {
                        this.setValue(event.target.value, true);
                        this.onValueSelected(event.target.value, causes.ENTER_PRESS);
                    }
            Severity: Minor
            Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 40 mins to fix
            packages/vue/src/components/search/DataSearch.jsx on lines 304..307
            packages/web/src/components/search/CategorySearch.js on lines 392..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 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

            There are no issues that match your filters.

            Category
            Status