appbaseio/reactivesearch

View on GitHub

Showing 334 of 1,376 total issues

Function getValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    getValue(value) {
        if (Array.isArray(value) && value.length) {
            return value.map(item => this.getValue(item));
        } else if (value && typeof value === 'object') {
            // TODO: support for NestedList
Severity: Minor
Found in packages/web/src/components/basic/URLParamsProvider.js - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {
            selectAllLabel, renderListItem, showLoadMore, loadMoreLabel,
        } = this.props;
        const { isLastBucket } = this.state;
Severity: Minor
Found in packages/web/src/components/list/SingleList.js - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    setURL(component, value) {
        const searchParams = this.props.getSearchParams
            ? this.props.getSearchParams()
            : window.location.search;
        this.params = new URLSearchParams(searchParams);
Severity: Minor
Found in packages/web/src/components/basic/URLParamsProvider.js - About 55 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 value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        value: function(predicate) {
            // 1. Let O be ? ToObject(this value).
            if (this == null) {
                throw new TypeError('"this" is null or not defined');
            }
Severity: Minor
Found in packages/web/src/polyfills.js - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    componentWillReceiveProps(nextProps) {
        if (!isEqual(this.props.range, nextProps.range) && nextProps.range) {
            this.updateQueryOptions(nextProps, nextProps.range);
            // floor and ceil to take edge cases into account
            this.updateRange({
Severity: Minor
Found in packages/web/src/components/range/DynamicRangeSlider.js - About 55 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 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

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

            const mapStateToProps = (state, props) => ({
                categories:
                    (state.aggregations[props.componentId]
                        && state.aggregations[props.componentId][props.categoryField]
                        && state.aggregations[props.componentId][props.categoryField].buckets)
            Severity: Minor
            Found in packages/web/src/components/search/CategorySearch.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

            Consider simplifying this complex logical expression.
            Open

                                if (label && ((isArray && value.length) || (!isArray && value))) {
                                    const valueToRender = this.renderValue(value, isArray);
                                    return (
                                        <Button
                                            class={getClassName(this.$props.innerClass, 'button') || ''}
            Severity: Major
            Found in packages/vue/src/components/basic/SelectedFilters.jsx - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if (
                          !isEqual(this.props.sortOptions, nextProps.sortOptions)
                          || this.props.sortBy !== nextProps.sortBy
                          || this.props.size !== nextProps.size
                          || !isEqual(this.props.dataField, nextProps.dataField)
              Severity: Major
              Found in packages/native/src/components/result/ReactiveList.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                                if (label && ((isArray && value.length) || (!isArray && value))) {
                                    const valueToRender = category
                                        ? this.renderValue(`${value} in ${category} category`, isArray)
                                        : this.renderValue(value, isArray);
                                    return (
                Severity: Major
                Found in packages/web/src/components/basic/SelectedFilters.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (
                              !isEqual(this.props.sortOptions, nextProps.sortOptions)
                              || this.props.sortBy !== nextProps.sortBy
                              || this.props.size !== nextProps.size
                              || !isEqual(this.props.dataField, nextProps.dataField)
                  Severity: Major
                  Found in packages/web/src/components/result/ReactiveList.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if (props.nestedField) {
                            options
                                = options
                                && state.aggregations[props.componentId][props.dataField][props.nestedField]
                                && state.aggregations[props.componentId][props.dataField][props.nestedField].buckets
                    Severity: Major
                    Found in packages/web/src/components/range/DynamicRangeSlider.js - About 40 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language