appbaseio/reactivesearch

View on GitHub

Showing 1,376 of 1,376 total issues

File SingleDropdownList.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from 'react';

import {
    addComponent,
    removeComponent,
Severity: Minor
Found in packages/web/src/components/list/SingleDropdownList.js - About 4 hrs to fix

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

                        {itemsToRender
                            .filter((item) => {
                                if (String(item.key).length) {
                                    if (this.props.showSearch && this.state.searchTerm) {
                                        return String(item.key)
    Severity: Major
    Found in packages/web/src/components/list/MultiList.js and 5 other locations - About 3 hrs to fix
    packages/vue/src/components/list/MultiList.jsx on lines 183..240
    packages/vue/src/components/list/SingleList.jsx on lines 169..232
    packages/vue/src/components/shared/DropDown.jsx on lines 113..194
    packages/web/src/components/shared/Dropdown.js on lines 155..231
    packages/web/src/components/list/SingleList.js on lines 323..377

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

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

                        {itemsToRender
                            .filter(item => {
                                if (String(item.key).length) {
                                    if (this.$props.showSearch && this.$data.searchTerm) {
                                        return String(item.key)
    Severity: Major
    Found in packages/vue/src/components/list/MultiList.jsx and 5 other locations - About 3 hrs to fix
    packages/vue/src/components/list/SingleList.jsx on lines 169..232
    packages/vue/src/components/shared/DropDown.jsx on lines 113..194
    packages/web/src/components/shared/Dropdown.js on lines 155..231
    packages/web/src/components/list/MultiList.js on lines 413..466
    packages/web/src/components/list/SingleList.js on lines 323..377

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

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

                                    {itemsToRender
                                        .filter((item) => {
                                            if (String(item[labelField]).length) {
                                                if (this.props.showSearch && this.state.searchTerm) {
                                                    return String(item[labelField])
    Severity: Major
    Found in packages/web/src/components/shared/Dropdown.js and 5 other locations - About 3 hrs to fix
    packages/vue/src/components/list/MultiList.jsx on lines 183..240
    packages/vue/src/components/list/SingleList.jsx on lines 169..232
    packages/vue/src/components/shared/DropDown.jsx on lines 113..194
    packages/web/src/components/list/MultiList.js on lines 413..466
    packages/web/src/components/list/SingleList.js on lines 323..377

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

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

                        {itemsToRender
                            .filter(item => {
                                if (String(item.key).length) {
                                    if (this.$props.showSearch && this.$data.searchTerm) {
                                        return String(item.key)
    Severity: Major
    Found in packages/vue/src/components/list/SingleList.jsx and 5 other locations - About 3 hrs to fix
    packages/vue/src/components/list/MultiList.jsx on lines 183..240
    packages/vue/src/components/shared/DropDown.jsx on lines 113..194
    packages/web/src/components/shared/Dropdown.js on lines 155..231
    packages/web/src/components/list/MultiList.js on lines 413..466
    packages/web/src/components/list/SingleList.js on lines 323..377

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

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

                                        {itemsToRender
                                            .filter(item => {
                                                if (String(item[labelField]).length) {
                                                    if (this.$props.showSearch && this.$data.searchTerm) {
                                                        return String(item[labelField])
    Severity: Major
    Found in packages/vue/src/components/shared/DropDown.jsx and 5 other locations - About 3 hrs to fix
    packages/vue/src/components/list/MultiList.jsx on lines 183..240
    packages/vue/src/components/list/SingleList.jsx on lines 169..232
    packages/web/src/components/shared/Dropdown.js on lines 155..231
    packages/web/src/components/list/MultiList.js on lines 413..466
    packages/web/src/components/list/SingleList.js on lines 323..377

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

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

                        {itemsToRender
                            .filter((item) => {
                                if (String(item.key).length) {
                                    if (this.props.showSearch && this.state.searchTerm) {
                                        return String(item.key)
    Severity: Major
    Found in packages/web/src/components/list/SingleList.js and 5 other locations - About 3 hrs to fix
    packages/vue/src/components/list/MultiList.jsx on lines 183..240
    packages/vue/src/components/list/SingleList.jsx on lines 169..232
    packages/vue/src/components/shared/DropDown.jsx on lines 113..194
    packages/web/src/components/shared/Dropdown.js on lines 155..231
    packages/web/src/components/list/MultiList.js on lines 413..466

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

    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 = (props) => {
            const queryOptions = getQueryOptions(props);
            queryOptions.size = 0;
            queryOptions.aggs = {
                [props.dataField]: {
    Severity: Major
    Found in packages/native/src/components/list/SingleDropdownList.js and 1 other location - About 3 hrs to fix
    packages/native/src/components/list/MultiDropdownList.js on lines 230..243

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

    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 = (props) => {
            const queryOptions = getQueryOptions(props);
            queryOptions.size = 0;
            queryOptions.aggs = {
                [props.dataField]: {
    Severity: Major
    Found in packages/native/src/components/list/MultiDropdownList.js and 1 other location - About 3 hrs to fix
    packages/native/src/components/list/SingleDropdownList.js on lines 143..156

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

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

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

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

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

    Refactorings

    Further Reading

    File SingleDropdownList.jsx has 326 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Actions, helper } from '@appbaseio/reactivecore';
    import VueTypes from 'vue-types';
    import types from '../../utils/vueTypes';
    import { getAggsQuery, getCompositeAggsQuery } from './utils';
    import Title from '../../styles/Title';
    Severity: Minor
    Found in packages/vue/src/components/list/SingleDropdownList.jsx - About 3 hrs 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 render has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            render(createElement, context) {
                const { props } = context;
                const start = getStartPage(props.pages, props.currentPage);
                const pages = [];
        
        
        Severity: Minor
        Found in packages/vue/src/components/result/addons/Pagination.jsx - About 3 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

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

                if (this.props.defaultSelected !== nextProps.defaultSelected) {
                    this.setValue(nextProps.defaultSelected, true, nextProps);
                } else if (
                    // since, selectedValue will be updated when currentValue changes,
                    // we must only check for the changes introduced by
        Severity: Major
        Found in packages/web/src/components/search/DataSearch.js and 2 other locations - About 3 hrs to fix
        packages/web/src/components/basic/TextField.js on lines 57..68
        packages/web/src/components/search/CategorySearch.js on lines 115..126

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

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

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

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

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

        Refactorings

        Further Reading

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

                if (this.props.defaultSelected !== nextProps.defaultSelected) {
                    this.setValue(nextProps.defaultSelected, true, nextProps);
                } else if (
                    // since, selectedValue will be updated when currentValue changes,
                    // we must only check for the changes introduced by
        Severity: Major
        Found in packages/web/src/components/search/CategorySearch.js and 2 other locations - About 3 hrs to fix
        packages/web/src/components/basic/TextField.js on lines 57..68
        packages/web/src/components/search/DataSearch.js on lines 102..113

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

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

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

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

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

        Refactorings

        Further Reading

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

                if (this.props.defaultSelected !== nextProps.defaultSelected) {
                    this.setValue(nextProps.defaultSelected, true, nextProps);
                } else if (
                    // since, selectedValue will be updated when currentValue changes,
                    // we must only check for the changes introduced by
        Severity: Major
        Found in packages/web/src/components/basic/TextField.js and 2 other locations - About 3 hrs to fix
        packages/web/src/components/search/CategorySearch.js on lines 115..126
        packages/web/src/components/search/DataSearch.js on lines 102..113

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

        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.props.selectedValue && this.props.selectedValue.location) {
                    this.setState(
                        {
                            currentLocation: this.props.selectedValue.location,
                        },
        Severity: Major
        Found in packages/maps/src/components/basic/GeoDistanceSlider.js and 1 other location - About 3 hrs to fix
        packages/maps/src/components/basic/GeoDistanceSlider.js on lines 75..88

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

        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

                } else if (this.props.defaultSelected && this.props.defaultSelected.location) {
                    this.setState(
                        {
                            currentLocation: this.props.defaultSelected.location,
                        },
        Severity: Major
        Found in packages/maps/src/components/basic/GeoDistanceSlider.js and 1 other location - About 3 hrs to fix
        packages/maps/src/components/basic/GeoDistanceSlider.js on lines 62..88

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

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

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

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

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

        Refactorings

        Further Reading

        File DatePicker.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Component } from 'react';
        import { View, Modal, TouchableWithoutFeedback, Platform } from 'react-native';
        import { Calendar } from 'react-native-calendars';
        import { Text, Body, Item, Header, Left, Button, Icon, Title, Right } from 'native-base';
        
        
        Severity: Minor
        Found in packages/native/src/components/date/DatePicker.js - About 3 hrs to fix

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

              render() {
                  const { selectAllLabel, showCount, renderListItem } = this.props;
                  const { options } = this.state;
          
                  if (options.length === 0) {
          Severity: Major
          Found in packages/web/src/components/list/SingleDataList.js - About 3 hrs to fix

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

                shouldComponentUpdate(nextProps) {
                    const upperLimit = Math.floor((nextProps.range.end - nextProps.range.start) / 2);
                    if (nextProps.stepValue < 1 || nextProps.stepValue > upperLimit) {
                        console.warn(
                            `stepValue for RangeSlider ${
            Severity: Major
            Found in packages/web/src/components/range/RangeSlider.js and 1 other location - About 3 hrs to fix
            packages/native/src/components/range/RangeSlider.js on lines 92..103

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

            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

            Severity
            Category
            Status
            Source
            Language