appbaseio/reactivesearch

View on GitHub

Showing 1,376 of 1,376 total issues

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

const mapStateToProps = (state, props) => ({
    selectedValue: state.selectedValues[props.componentId]
        ? state.selectedValues[props.componentId].value
        : null,
});
Severity: Major
Found in packages/web/src/components/date/DatePicker.js and 6 other locations - About 50 mins to fix
packages/native/src/components/date/DatePicker.js on lines 330..334
packages/native/src/components/date/DateRange.js on lines 495..499
packages/native/src/components/range/MultiDropdownRange.js on lines 323..327
packages/web/src/components/basic/NumberBox.js on lines 238..242
packages/web/src/components/date/DateRange.js on lines 456..460
packages/web/src/components/range/MultiRange.js on lines 266..270

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

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

const mapStateToProps = (state, props) => ({
    selectedValue: state.selectedValues[props.componentId]
        ? state.selectedValues[props.componentId].value
        : null,
});
Severity: Major
Found in packages/native/src/components/date/DateRange.js and 6 other locations - About 50 mins to fix
packages/native/src/components/date/DatePicker.js on lines 330..334
packages/native/src/components/range/MultiDropdownRange.js on lines 323..327
packages/web/src/components/basic/NumberBox.js on lines 238..242
packages/web/src/components/date/DatePicker.js on lines 258..262
packages/web/src/components/date/DateRange.js on lines 456..460
packages/web/src/components/range/MultiRange.js on lines 266..270

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

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

const mapStateToProps = (state, props) => ({
    selectedValue: state.selectedValues[props.componentId]
        ? state.selectedValues[props.componentId].value
        : null,
});
Severity: Major
Found in packages/web/src/components/range/MultiRange.js and 6 other locations - About 50 mins to fix
packages/native/src/components/date/DatePicker.js on lines 330..334
packages/native/src/components/date/DateRange.js on lines 495..499
packages/native/src/components/range/MultiDropdownRange.js on lines 323..327
packages/web/src/components/basic/NumberBox.js on lines 238..242
packages/web/src/components/date/DatePicker.js on lines 258..262
packages/web/src/components/date/DateRange.js on lines 456..460

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

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

const mapStateToProps = (state, props) => ({
    selectedValue: state.selectedValues[props.componentId]
        ? state.selectedValues[props.componentId].value
        : null,
});
Severity: Major
Found in packages/web/src/components/date/DateRange.js and 6 other locations - About 50 mins to fix
packages/native/src/components/date/DatePicker.js on lines 330..334
packages/native/src/components/date/DateRange.js on lines 495..499
packages/native/src/components/range/MultiDropdownRange.js on lines 323..327
packages/web/src/components/basic/NumberBox.js on lines 238..242
packages/web/src/components/date/DatePicker.js on lines 258..262
packages/web/src/components/range/MultiRange.js on lines 266..270

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 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/CategorySearch.js and 1 other location - About 50 mins to fix
packages/web/src/components/search/DataSearch.js on lines 273..278

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

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

                                <label
                                    class={
                                        getClassName(this.$props.innerClass, 'label')
                                        || 'range-label-right'
                                    }
Severity: Minor
Found in packages/vue/src/components/range/RangeSlider.jsx and 1 other location - About 50 mins to fix
packages/vue/src/components/range/RangeSlider.jsx on lines 178..185

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

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

                                <label
                                    class={
                                        getClassName(this.$props.innerClass, 'label')
                                        || 'range-label-left'
                                    }
Severity: Minor
Found in packages/vue/src/components/range/RangeSlider.jsx and 1 other location - About 50 mins to fix
packages/vue/src/components/range/RangeSlider.jsx on lines 186..193

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

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

Todo.propTypes = {
    onClick: PropTypes.func.isRequired,
    completed: PropTypes.bool.isRequired,
    text: PropTypes.string.isRequired,
};
Severity: Minor
Found in packages/web/examples/withRedux/src/components/Todo.js and 1 other location - About 50 mins to fix
packages/web/examples/withRedux/src/components/Link.js on lines 23..27

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

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

Link.propTypes = {
    active: PropTypes.bool.isRequired,
    children: PropTypes.node.isRequired,
    onClick: PropTypes.func.isRequired,
};
Severity: Minor
Found in packages/web/examples/withRedux/src/components/Link.js and 1 other location - About 50 mins to fix
packages/web/examples/withRedux/src/components/Todo.js on lines 17..21

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

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

Function renderAsCard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        renderAsCard({ item, triggerClickAnalytics }) {
            const onData = this.$props.onData || this.$scopedSlots.onData;
            const result = onData(item);
            if (result) {
                return (
Severity: Minor
Found in packages/vue/src/components/result/ResultCard.jsx - About 45 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

Avoid deeply nested control flow statements.
Open

                if (hasMissingTerm) {
                    should = should.concat({
                        bool: {
                            must_not: {
                                exists: { field: props.dataField }
Severity: Major
Found in packages/vue/src/components/list/MultiList.jsx - About 45 mins to fix

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

        render() {
            let selectAll = [];
    
            if (this.state.options.length === 0) {
                return null;
    Severity: Minor
    Found in packages/native/src/components/list/MultiDropdownList.js - About 45 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 handleWindowMouseup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            handleWindowMouseup(event) {
                this.isMouseDown = false;
    
                if (
                    (event.target === this.$refs.rootNode
    Severity: Minor
    Found in packages/vue/src/components/basic/DownShift.jsx - About 45 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

    Avoid deeply nested control flow statements.
    Open

                    if (hasMissingTerm) {
                        should = should.concat({
                            bool: {
                                must_not: {
                                    exists: { field: props.dataField }
    Severity: Major
    Found in packages/vue/src/components/list/MultiDropdownList.jsx - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (
                                      selectedValues[component.componentId]
                                      && selectedValues[component.componentId].value
                                  ) {
                                      currentPage = selectedValues[component.componentId].value - 1 || 0;
      Severity: Major
      Found in packages/web/src/server/index.js - About 45 mins to fix

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

            componentWillReceiveProps(nextProps) {
                if (
                    nextProps.onAllData
                    && (!isEqual(nextProps.hits, this.props.hits)
                        || !isEqual(nextProps.aggregations, this.props.aggregations))
        Severity: Minor
        Found in packages/web/src/components/basic/ReactiveComponent.js - About 45 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

        Avoid deeply nested control flow statements.
        Open

                            if (hasMissingTerm) {
                                should = should.concat({
                                    bool: {
                                        must_not: {
                                            exists: { field: props.dataField },
        Severity: Major
        Found in packages/web/src/components/list/MultiDropdownList.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if (hasMissingTerm) {
                                  should = should.concat({
                                      bool: {
                                          must_not: {
                                              exists: { field: props.dataField },
          Severity: Major
          Found in packages/web/src/components/list/MultiList.js - About 45 mins to fix

            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/native/src/components/range/RangeSlider.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/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
            packages/web/src/components/search/DataSearch.js on lines 116..119

            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

            Severity
            Category
            Status
            Source
            Language