appbaseio/reactivesearch

View on GitHub
packages/vue/src/components/result/ReactiveList.jsx

Summary

Maintainability
F
6 days
Test Coverage

File ReactiveList.jsx has 554 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Actions, helper } from '@appbaseio/reactivecore';
import VueTypes from 'vue-types';
import Pagination from './addons/Pagination.jsx';
import PoweredBy from './addons/PoweredBy.jsx';
import { connect } from '../../utils/index';
Severity: Major
Found in packages/vue/src/components/result/ReactiveList.jsx - About 1 day to fix

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

        render() {
            const { size } = this.$props;
            const { hits } = this.$data;
            const results = parseHits(hits) || [];
            const streamResults = parseHits(this.$data.streamHits) || [];
    Severity: Major
    Found in packages/vue/src/components/result/ReactiveList.jsx - About 3 hrs to fix

      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

      Function mounted has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          mounted() {
              this.addComponent(this.internalComponent);
              this.addComponent(this.$props.componentId);
      
              if (this.$props.stream) {
      Severity: Major
      Found in packages/vue/src/components/result/ReactiveList.jsx - About 2 hrs to fix

        Function mounted has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            mounted() {
                this.addComponent(this.internalComponent);
                this.addComponent(this.$props.componentId);
        
                if (this.$props.stream) {
        Severity: Minor
        Found in packages/vue/src/components/result/ReactiveList.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 setPage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                setPage(page) {
                    // pageClick will be called everytime a pagination button is clicked
                    if (page !== this.$currentPage) {
                        this.$emit('pageClick', page + 1);
                        const value = this.$props.size * page;
        Severity: Minor
        Found in packages/vue/src/components/result/ReactiveList.jsx - About 1 hr to fix

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

                  if (this.$props.sortOptions) {
                      options.sort = [
                          {
                              [this.$props.sortOptions[0].dataField]: {
                                  order: this.$props.sortOptions[0].sortBy,
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 2 other locations - About 4 hrs to fix
          packages/native/src/components/result/ReactiveList.js on lines 60..76
          packages/web/src/components/result/ReactiveList.js on lines 59..75

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

          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

                          <select
                              class={`${sortOptions} ${getClassName(this.$props.innerClass, 'sortOptions')}`}
                              name="sort-options"
                              onChange={this.handleSortChange}
                          >
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 4 hrs to fix
          packages/web/src/components/result/ReactiveList.js on lines 509..519

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

          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

                          <Flex
                              labelPosition={this.$props.sortOptions ? 'right' : 'left'}
                              class={getClassName(this.$props.innerClass, 'resultsInfo')}
                          >
                              {this.$props.sortOptions ? this.renderSortOptions() : null}
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 3 hrs to fix
          packages/web/src/components/result/ReactiveList.js on lines 537..543

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

          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 (config.analytics && url.endsWith('scalr.api.appbase.io') && searchId) {
                          fetch(`${url}/${app}/analytics`, {
                              method: 'POST',
                              headers: {
                                  'Content-Type': 'application/json',
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 3 hrs to fix
          packages/web/src/components/result/ReactiveList.js on lines 494..505

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

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

                  setReact(props) {
                      const { react } = props;
          
                      if (react) {
                          const newReact = pushToAndClause(react, this.internalComponent);
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 4 other locations - About 2 hrs to fix
          packages/vue/src/components/list/MultiDropdownList.jsx on lines 216..227
          packages/vue/src/components/list/MultiList.jsx on lines 247..258
          packages/vue/src/components/list/SingleDropdownList.jsx on lines 203..214
          packages/vue/src/components/list/SingleList.jsx on lines 239..250

          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

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

                      if (this.$data.total) {
                          return (
                              <p
                                  class={`${resultStats} ${getClassName(
                                      this.$props.innerClass,
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 2 hrs to fix
          packages/web/src/components/result/ReactiveList.js on lines 428..439

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

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

                  if (streamResults.length) {
                      const ids = streamResults.map(item => item._id);
                      filteredResults = filteredResults.filter(item => !ids.includes(item._id));
                  }
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 4 other locations - About 1 hr to fix
          packages/maps-native/src/components/maps/ReactiveMap.js on lines 396..399
          packages/maps/src/components/result/ReactiveMap.js on lines 863..866
          packages/native/src/components/result/ReactiveList.js on lines 489..492
          packages/web/src/components/result/ReactiveList.js on lines 529..532

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

          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

                      options.sort = [
                          {
                              [this.$props.sortOptions[index].dataField]: {
                                  order: this.$props.sortOptions[index].sortBy,
                              },
          Severity: Major
          Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 1 hr to fix
          packages/web/src/components/result/ReactiveList.js on lines 455..461

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

          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 {
              addComponent,
              removeComponent,
              setStreaming,
              watchComponent,
          Severity: Minor
          Found in packages/vue/src/components/result/ReactiveList.jsx and 1 other location - About 40 mins to fix
          packages/vue/src/components/shared/DropDown.jsx on lines 39..49

          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

              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

                          {this.config.url.endsWith('appbase.io') && results.length ? (
                              <Flex
                                  direction="row-reverse"
                                  class={getClassName(this.$props.innerClass, 'poweredBy')}
                              >
          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 601..608

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

          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

                              <div
                                  class={`${this.$props.listClass} ${getClassName(
                                      this.$props.innerClass,
                                      'list',
                                  )}`}
          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 565..574

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

          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