appbaseio/reactivesearch

View on GitHub
packages/vue/src/components/search/DataSearch.jsx

Summary

Maintainability
F
4 days
Test Coverage

File DataSearch.jsx has 621 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    Actions,
    helper,
    suggestions as getSuggestions,
    causes
Severity: Major
Found in packages/vue/src/components/search/DataSearch.jsx - About 1 day to fix

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

        render() {
            const { theme } = this.$props;
            const renderSuggestions = this.$scopedSlots.suggestions;
            return (
                <Container class={this.$props.className}>
    Severity: Major
    Found in packages/vue/src/components/search/DataSearch.jsx - About 5 hrs to fix

      Function setValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

              setValue(value, isDefaultValue = false, props = this.$props, cause) {
                  // ignore state updates when component is locked
                  if (props.beforeValueChange && this.locked) {
                      return;
                  }
      Severity: Minor
      Found in packages/vue/src/components/search/DataSearch.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 shouldQuery has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      DataSearch.shouldQuery = (value, dataFields, props) => {
          const fields = dataFields.map(
              (field, index) =>
                  `${field}${
                      Array.isArray(props.fieldWeights) && props.fieldWeights[index]
      Severity: Minor
      Found in packages/vue/src/components/search/DataSearch.jsx - About 1 hr to fix

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

            render() {
                const { theme } = this.$props;
                const renderSuggestions = this.$scopedSlots.suggestions;
                return (
                    <Container class={this.$props.className}>
        Severity: Minor
        Found in packages/vue/src/components/search/DataSearch.jsx - About 1 hr 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 setValue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                setValue(value, isDefaultValue = false, props = this.$props, cause) {
                    // ignore state updates when component is locked
                    if (props.beforeValueChange && this.locked) {
                        return;
                    }
        Severity: Minor
        Found in packages/vue/src/components/search/DataSearch.jsx - About 1 hr to fix

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

                              if (props.strictSelection) {
                                  if (cause === causes.SUGGESTION_SELECT || value === '') {
                                      this.updateQueryHandler(props.componentId, value, props);
                                  } else {
                                      this.setValue('', true);
          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 281..289

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 91.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 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 3 locations. Consider refactoring.
          Open

                  if (this.selectedValue) {
                      this.setValue(this.selectedValue, true);
                  } else if (this.$props.defaultSelected) {
                      this.setValue(this.$props.defaultSelected, true);
                  }
          Severity: Major
          Found in packages/vue/src/components/search/DataSearch.jsx and 2 other locations - About 1 hr to fix
          packages/vue/src/components/list/MultiDropdownList.jsx on lines 85..89
          packages/vue/src/components/range/MultiRange.jsx on lines 132..136

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

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

                          {this.$props.title && (
                              <Title class={getClassName(this.$props.innerClass, 'title') || ''}>
                                  {this.$props.title}
                              </Title>
                          )}
          Severity: Major
          Found in packages/vue/src/components/search/DataSearch.jsx and 3 other locations - About 1 hr to fix
          packages/vue/src/components/list/MultiDropdownList.jsx on lines 176..180
          packages/vue/src/components/list/SingleDropdownList.jsx on lines 163..167
          packages/vue/src/components/list/SingleList.jsx on lines 133..137

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 62.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  updateQueryOptions() {
                      const queryOptions = DataSearch.highlightQuery(this.$props) || {};
                      queryOptions.size = 20;
                      this.setQueryOptions(this.$props.componentId, queryOptions);
                  },
          Severity: Major
          Found in packages/vue/src/components/search/DataSearch.jsx and 1 other location - About 1 hr to fix
          packages/vue/src/components/search/DataSearch.jsx on lines 108..112

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 58.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  if (this.$props.highlight) {
                      const queryOptions = DataSearch.highlightQuery(this.$props) || {};
                      queryOptions.size = 20;
                      this.setQueryOptions(this.$props.componentId, queryOptions);
                  } else {
          Severity: Major
          Found in packages/vue/src/components/search/DataSearch.jsx and 1 other location - About 1 hr to fix
          packages/vue/src/components/search/DataSearch.jsx on lines 186..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 58.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  onSuggestionSelected(suggestion) {
                      this.setValue(
                          suggestion.value,
                          true,
                          this.$props,
          Severity: Major
          Found in packages/vue/src/components/search/DataSearch.jsx and 1 other location - About 1 hr to fix
          packages/web/src/components/search/DataSearch.js on lines 376..379

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 55.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                      if (event.key === 'Enter' && highlightedIndex === null) {
                          this.setValue(event.target.value, true);
                          this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
                      }
          Severity: Minor
          Found in packages/vue/src/components/search/DataSearch.jsx and 2 other locations - About 40 mins to fix
          packages/web/src/components/search/CategorySearch.js on lines 392..395
          packages/web/src/components/search/DataSearch.js on lines 357..360

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          There are no issues that match your filters.

          Category
          Status