appbaseio/reactivesearch

View on GitHub

Showing 1,376 of 1,376 total issues

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

    toggleTopic = (topic) => {
        const { currentTopics } = this.state;
        const nextState = currentTopics.includes(topic)
            ? currentTopics.filter(item => item !== topic)
            : currentTopics.concat(topic);
Severity: Major
Found in site/demos/gitxplore/src/App.js and 1 other location - About 2 hrs to fix
site/demos/gitxplore-dark/src/App.js on lines 26..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

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

File base.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { css } from 'emotion';

import queries from './mediaQueries';

const primaryColor = '#6772e5';
Severity: Minor
Found in site/src/styles/base.js - About 2 hrs to fix

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

                        <div className="col">
                            <SelectedFilters />
                            <ResultList
                                componentId="SearchResult"
                                dataField="original_title"
    Severity: Major
    Found in packages/web/examples/SelectedFilters/src/index.js and 2 other locations - About 2 hrs to fix
    packages/web/examples/CategorySearch/src/index.js on lines 30..44
    packages/web/examples/TextField/src/index.js on lines 20..34

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 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 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/CategorySearch.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/DataSearch.js on lines 302..308

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

                        <div className="col">
                            <SelectedFilters />
                            <ResultList
                                componentId="SearchResult"
                                dataField="original_title"
    Severity: Major
    Found in packages/web/examples/TextField/src/index.js and 2 other locations - About 2 hrs to fix
    packages/web/examples/CategorySearch/src/index.js on lines 30..44
    packages/web/examples/SelectedFilters/src/index.js on lines 24..38

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

                        <div className="col">
                            <SelectedFilters />
                            <ResultList
                                componentId="SearchResult"
                                dataField="original_title"
    Severity: Major
    Found in packages/web/examples/CategorySearch/src/index.js and 2 other locations - About 2 hrs to fix
    packages/web/examples/SelectedFilters/src/index.js on lines 24..38
    packages/web/examples/TextField/src/index.js on lines 20..34

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 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 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/native/src/components/search/DataSearch.js and 2 other locations - About 2 hrs to fix
    packages/web/src/components/search/CategorySearch.js on lines 338..344
    packages/web/src/components/search/DataSearch.js on lines 302..308

    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

                        <div className="col">
                            <SelectedFilters />
                            <ResultList
                                componentId="SearchResult"
                                dataField="original_title"
    Severity: Major
    Found in packages/web/examples/DynamicRangeSlider/src/index.js and 1 other location - About 2 hrs to fix
    packages/web/examples/RangeSlider/src/index.js on lines 31..45

    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

                        <div className="col">
                            <SelectedFilters />
                            <ResultList
                                componentId="SearchResult"
                                dataField="original_title"
    Severity: Major
    Found in packages/web/examples/RangeSlider/src/index.js and 1 other location - About 2 hrs to fix
    packages/web/examples/DynamicRangeSlider/src/index.js on lines 32..46

    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

    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/vue/src/components/search/DataSearch.jsx and 1 other location - About 2 hrs to fix
    packages/web/src/components/search/DataSearch.js on lines 164..176

    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

    const disabled = ({ theme }) => css`
        background-color: ${theme.colors.backgroundColor
            ? lighten(0.1, theme.colors.backgroundColor)
            : '#fafafa'};
        color: #ccc;
    Severity: Major
    Found in packages/vue/src/styles/Button.js and 1 other location - About 2 hrs to fix
    packages/web/src/styles/Button.js on lines 92..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 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

    const disabled = ({ theme }) => css`
        background-color: ${(theme.colors.backgroundColor
            ? lighten(0.1, theme.colors.backgroundColor)
            : '#fafafa')};
        color: #ccc;
    Severity: Major
    Found in packages/web/src/styles/Button.js and 1 other location - About 2 hrs to fix
    packages/vue/src/styles/Button.js on lines 88..101

    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

    Function defaultQuery has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MultiList.defaultQuery = (value, props) => {
        let query = null;
        const type = props.queryFormat === 'or' ? 'terms' : 'term';
    
        if (!Array.isArray(value) || value.length === 0) {
    Severity: Major
    Found in packages/vue/src/components/list/MultiList.jsx - About 2 hrs to fix

      Function setValue has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              setValue(value, isDefaultValue = false, props = this.$props) {
                  // ignore state updates when component is locked
                  if (props.beforeValueChange && this.locked) {
                      return;
                  }
      Severity: Major
      Found in packages/vue/src/components/list/MultiList.jsx - About 2 hrs to fix

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

                            {options
                                .filter((item) => {
                                    if (this.props.showSearch && this.state.searchTerm) {
                                        return item.label
                                            .toLowerCase()
        Severity: Major
        Found in packages/web/src/components/list/SingleDataList.js and 1 other location - About 2 hrs to fix
        packages/web/src/components/list/MultiDataList.js on lines 370..420

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

        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

                            {options
                                .filter((item) => {
                                    if (this.props.showSearch && this.state.searchTerm) {
                                        return item.label
                                            .toLowerCase()
        Severity: Major
        Found in packages/web/src/components/list/MultiDataList.js and 1 other location - About 2 hrs to fix
        packages/web/src/components/list/SingleDataList.js on lines 290..341

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

        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 hits has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

                hits(newVal, oldVal) {
                    if (this.$props.pagination) {
                        // called when page is changed
                        if (this.isLoading && (oldVal || newVal)) {
                            if (this.hasPageChangeListener) {
        Severity: Minor
        Found in packages/vue/src/components/result/ReactiveList.jsx - About 2 hrs 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 render has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            render() {
                const { size } = this.$props;
                const { hits } = this.$data;
                const results = parseHits(hits) || [];
                const streamResults = parseHits(this.$data.streamHits) || [];
        Severity: Minor
        Found in packages/vue/src/components/result/ReactiveList.jsx - About 2 hrs 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

        Severity
        Category
        Status
        Source
        Language