appbaseio/reactivesearch

View on GitHub

Showing 1,376 of 1,376 total issues

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

        dataField() {
            this.updateQueryOptions(this.$props);
            this.updateQueryHandler(this.$data.currentValue, this.$props);
        },
Severity: Major
Found in packages/vue/src/components/list/SingleDropdownList.jsx and 3 other locations - About 35 mins to fix
packages/vue/src/components/list/MultiDropdownList.jsx on lines 146..149
packages/vue/src/components/list/MultiList.jsx on lines 106..109
packages/vue/src/components/list/SingleList.jsx on lines 105..108

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

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

    props.stats.forEach((item) => {
        if (max < item.doc_count) {
            max = item.doc_count;
        }
    });
Severity: Minor
Found in packages/native/src/components/range/addons/Histogram.js and 1 other location - About 35 mins to fix
packages/web/src/components/range/addons/HistogramContainer.js on lines 19..23

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

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

    updateQueryOptions = (props) => {
        const queryOptions = SingleDataList.generateQueryOptions(props, this.state);
        props.setQueryOptions(this.internalComponent, queryOptions);
    };
Severity: Minor
Found in packages/web/src/components/list/SingleDataList.js and 1 other location - About 35 mins to fix
packages/web/src/components/list/MultiDataList.js on lines 269..272

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

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

    updateQueryOptions = (props) => {
        const queryOptions = MultiDataList.generateQueryOptions(props, this.state);
        props.setQueryOptions(this.internalComponent, queryOptions);
    };
Severity: Minor
Found in packages/web/src/components/list/MultiDataList.js and 1 other location - About 35 mins to fix
packages/web/src/components/list/SingleDataList.js on lines 187..190

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

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

    defaultPage:
        (state.selectedValues[props.componentId]
            && state.selectedValues[props.componentId].value - 1)
        || -1,
Severity: Minor
Found in packages/web/src/components/result/ReactiveList.js and 1 other location - About 35 mins to fix
packages/vue/src/components/result/ReactiveList.jsx on lines 570..573

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

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

    defaultPage:
        (state.selectedValues[props.componentId]
            && state.selectedValues[props.componentId].value - 1)
        || -1,
Severity: Minor
Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 35 mins to fix
packages/web/src/components/result/ReactiveList.js on lines 683..686

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

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

        renderIcon() {
            if (this.$props.showIcon) {
                return this.$props.icon || <SearchSvg />;
            }

Severity: Minor
Found in packages/vue/src/components/search/DataSearch.jsx and 1 other location - About 35 mins to fix
packages/vue/src/components/search/DataSearch.jsx on lines 365..371

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

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

        renderCancelIcon() {
            if (this.$props.showClear) {
                return this.$props.clearIcon || <CancelSvg />;
            }

Severity: Minor
Found in packages/vue/src/components/search/DataSearch.jsx and 1 other location - About 35 mins to fix
packages/vue/src/components/search/DataSearch.jsx on lines 357..363

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

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

    render() {
        const { selectAllLabel, renderListItem } = this.$props;
        const renderListItemCalc
            = this.$scopedSlots.renderListItem || renderListItem;
        if (this.modifiedOptions.length === 0) {
Severity: Minor
Found in packages/vue/src/components/list/SingleList.jsx - 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 timeSince has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function timeSince(date) {
    const seconds = Math.floor((new Date() - date) / 1000);

    let interval = Math.floor(seconds / 31536000);

Severity: Minor
Found in site/demos/technews/src/components/Results.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {
            config,
            theme: { secondary, primaryDark, textDark },
        } = this.props;
Severity: Minor
Found in site/src/components/Tools.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 validateLocation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function validateLocation(props, propName) {
    // eslint-disable-next-line
    if (isNaN(props[propName])) {
        return new Error(`${propName} value must be a VueTypes.number`);
    }
Severity: Minor
Found in packages/vue/src/utils/vueTypes.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        if (this.$scopedSlots.default) {
            return this.$scopedSlots.default(this.$props);
        }
        const filtersToRender = this.renderFilters();
Severity: Minor
Found in packages/vue/src/components/basic/SelectedFilters.jsx - 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 setURL has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        setURL(component, value) {
            this.$params = new URLSearchParams(window.location.search);

            if (
                !value
Severity: Minor
Found in packages/vue/src/components/URLParamsProvider.jsx - 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 renderToString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        renderToString(value) {
            if (Array.isArray(value) && value.length) {
                const arrayToRender = value.map(item => this.renderToString(item));
                return arrayToRender.join(', ');
            } else if (value && typeof value === 'object') {
Severity: Minor
Found in packages/vue/src/components/shared/DropDown.jsx - 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 defaultQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

SingleDropdownList.defaultQuery = (value, props) => {
    let query = null;
    if (props.selectAllLabel && props.selectAllLabel === value) {
        if (props.showMissing) {
            query = { match_all: {} };
Severity: Minor
Found in packages/vue/src/components/list/SingleDropdownList.jsx - 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/native/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 defaultQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

SingleList.defaultQuery = (value, props) => {
    if (props.selectAllLabel && props.selectAllLabel === value) {
        if (props.showMissing) {
            return { match_all: {} };
        }
Severity: Minor
Found in packages/vue/src/components/list/SingleList.jsx - 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 getValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        getValue(value) {
            if (Array.isArray(value) && value.length) {
                return value.map(item => this.getValue(item));
            }
            if (value && typeof value === 'object') {
Severity: Minor
Found in packages/vue/src/components/URLParamsProvider.jsx - 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 mapStateToProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const mapStateToProps = (state, props) => ({
    mapKey: state.config.mapKey,
    hits: (state.hits[props.componentId] && state.hits[props.componentId].hits) || [],
    streamHits: state.streamHits[props.componentId] || [],
    currentPage:
Severity: Minor
Found in packages/maps-native/src/components/maps/ReactiveMap.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

Severity
Category
Status
Source
Language