appbaseio/reactivesearch

View on GitHub
packages/maps/src/components/result/ReactiveMap.js

Summary

Maintainability
F
2 wks
Test Coverage

File ReactiveMap.js has 938 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from 'react';
import { withGoogleMap, GoogleMap, Marker, InfoWindow } from 'react-google-maps';
import MarkerClusterer from 'react-google-maps/lib/components/addons/MarkerClusterer';
import { MarkerWithLabel } from 'react-google-maps/lib/components/addons/MarkerWithLabel';
import {
Severity: Major
Found in packages/maps/src/components/result/ReactiveMap.js - About 2 days to fix

    Function componentWillReceiveProps has 116 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        componentWillReceiveProps(nextProps) {
            if (
                this.props.sortBy !== nextProps.sortBy
                || this.props.size !== nextProps.size
                || !isEqual(this.props.dataField, nextProps.dataField)
    Severity: Major
    Found in packages/maps/src/components/result/ReactiveMap.js - About 4 hrs to fix

      ReactiveMap has 33 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ReactiveMap extends Component {
          constructor(props) {
              super(props);
      
              this.mapStyles = [
      Severity: Minor
      Found in packages/maps/src/components/result/ReactiveMap.js - About 4 hrs to fix

        Function componentWillReceiveProps has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            componentWillReceiveProps(nextProps) {
                if (
                    this.props.sortBy !== nextProps.sortBy
                    || this.props.size !== nextProps.size
                    || !isEqual(this.props.dataField, nextProps.dataField)
        Severity: Minor
        Found in packages/maps/src/components/result/ReactiveMap.js - About 4 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 componentDidMount has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            componentDidMount() {
                this.props.addComponent(this.internalComponent);
                this.props.addComponent(this.props.componentId);
        
                if (this.props.stream) {
        Severity: Minor
        Found in packages/maps/src/components/result/ReactiveMap.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (
                      this.state.searchAsMove !== nextState.searchAsMove
                      || this.state.markerOnTop !== nextState.markerOnTop
                      || this.props.showMapStyles !== nextProps.showMapStyles
                      || this.props.autoCenter !== nextProps.autoCenter
          Severity: Critical
          Found in packages/maps/src/components/result/ReactiveMap.js - About 1 hr to fix

            Function constructor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                constructor(props) {
                    super(props);
            
                    this.mapStyles = [
                        { label: 'Standard', value: Standard },
            Severity: Minor
            Found in packages/maps/src/components/result/ReactiveMap.js - About 1 hr to fix

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

                  componentDidMount() {
                      this.props.addComponent(this.internalComponent);
                      this.props.addComponent(this.props.componentId);
              
                      if (this.props.stream) {
              Severity: Minor
              Found in packages/maps/src/components/result/ReactiveMap.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

              Avoid too many return statements within this function.
              Open

                      return this.getDefaultCenter();
              Severity: Major
              Found in packages/maps/src/components/result/ReactiveMap.js - About 30 mins to fix

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

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

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

                    getHitsCenter = (hits) => {
                        const data = hits.map(hit => hit[this.props.dataField]);
                
                        if (data.length) {
                            const numCoords = data.length;
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 2 days to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 225..277

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

                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 mapStateToProps = (state, props) => ({
                    mapKey: state.config.mapKey,
                    hits: (state.hits[props.componentId] && state.hits[props.componentId].hits) || [],
                    streamHits: state.streamHits[props.componentId] || [],
                    currentPage:
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 1 day to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 730..740

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

                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

                    loadMore = () => {
                        if (
                            this.props.hits
                            && !this.props.pagination
                            && this.props.total !== this.props.hits.length
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 2 other locations - About 1 day to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 279..305
                packages/native/src/components/result/ReactiveList.js on lines 251..277

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

                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

                    setPage = (page) => {
                        const value = this.props.size * page;
                        const options = getQueryOptions(this.props);
                        options.from = this.state.from;
                        this.setState({
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 1 day to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 307..334

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

                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

                    parseLocation(location) {
                        if (Array.isArray(location)) {
                            return {
                                lat: Number(location[0]),
                                lng: Number(location[1]),
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 5 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 343..356

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

                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 (
                            !nextProps.pagination
                            && nextProps.hits
                            && this.props.hits
                            && nextProps.hits.length < this.props.hits.length
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 3 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 179..192

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

                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 (
                            !nextProps.pagination
                            && this.props.hits
                            && nextProps.hits
                            && (this.props.hits.length < nextProps.hits.length
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 2 other locations - About 3 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 167..177
                packages/native/src/components/result/ReactiveList.js on lines 190..200

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

                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

                        this.mapStyles = [
                            { label: 'Standard', value: Standard },
                            { label: 'Blue Essence', value: BlueEssence },
                            { label: 'Blue Water', value: BlueWater },
                            { label: 'Flat Map', value: FlatMap },
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 3 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 47..55

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

                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 (nextProps.pagination && nextProps.total !== this.props.total) {
                            this.setState({
                                totalPages: Math.ceil(nextProps.total / nextProps.size),
                                currentPage: this.props.total ? 0 : this.state.currentPage,
                            });
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 3 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 194..199

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

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

                    setReact = (props) => {
                        const { react } = props;
                        if (react) {
                            const newReact = pushToAndClause(react, this.internalComponent);
                            props.watchComponent(props.componentId, newReact);
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 14 other locations - About 2 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 215..223
                packages/native/src/components/list/MultiDropdownList.js on lines 99..107
                packages/native/src/components/list/SingleDropdownList.js on lines 83..91
                packages/native/src/components/range/RangeSlider.js on lines 110..118
                packages/native/src/components/result/ReactiveList.js on lines 241..249
                packages/native/src/components/search/DataSearch.js on lines 108..116
                packages/web/src/components/basic/TagCloud.js on lines 97..107
                packages/web/src/components/list/MultiDropdownList.js on lines 123..133
                packages/web/src/components/list/MultiList.js on lines 117..127
                packages/web/src/components/list/SingleDropdownList.js on lines 112..122
                packages/web/src/components/list/SingleList.js on lines 108..118
                packages/web/src/components/range/RangeSlider.js on lines 115..125
                packages/web/src/components/search/CategorySearch.js on lines 144..154
                packages/web/src/components/search/DataSearch.js on lines 121..131

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

                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.defaultMapStyle !== nextProps.defaultMapStyle) {
                            this.setState({
                                currentMapStyle:
                                    this.mapStyles.find(style => style.label === nextProps.defaultMapStyle)
                                    || this.mapStyles[0],
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 2 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 201..207

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

                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

                                {this.props.onAllData
                                    ? this.props.onAllData(
                                        parseHits(this.props.hits),
                                        parseHits(this.props.streamHits),
                                        this.loadMore,
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 2 hrs to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 641..649

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

                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/maps/src/components/result/ReactiveMap.js and 4 other locations - About 1 hr to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 396..399
                packages/native/src/components/result/ReactiveList.js on lines 489..492
                packages/vue/src/components/result/ReactiveList.jsx on lines 296..299
                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

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

                        if (this.props.pagination && this.state.isLoading) {
                            if (nextProps.onPageChange) {
                                nextProps.onPageChange();
                            }
                            this.setState({
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 1 hr to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 158..165

                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

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

                        if (
                            this.props.sortBy !== nextProps.sortBy
                            || this.props.size !== nextProps.size
                            || !isEqual(this.props.dataField, nextProps.dataField)
                        ) {
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 1 hr to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 115..132

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

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

                    componentWillUnmount() {
                        this.props.removeComponent(this.props.componentId);
                        this.props.removeComponent(this.internalComponent);
                    }
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 15 other locations - About 45 mins to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 210..213
                packages/native/src/components/list/MultiDropdownList.js on lines 94..97
                packages/native/src/components/list/SingleDropdownList.js on lines 78..81
                packages/native/src/components/range/RangeSlider.js on lines 105..108
                packages/native/src/components/search/DataSearch.js on lines 103..106
                packages/web/src/components/basic/TagCloud.js on lines 92..95
                packages/web/src/components/list/MultiDataList.js on lines 100..103
                packages/web/src/components/list/MultiDropdownList.js on lines 118..121
                packages/web/src/components/list/MultiList.js on lines 112..115
                packages/web/src/components/list/SingleDataList.js on lines 88..91
                packages/web/src/components/list/SingleDropdownList.js on lines 107..110
                packages/web/src/components/list/SingleList.js on lines 103..106
                packages/web/src/components/range/RangeSlider.js on lines 110..113
                packages/web/src/components/search/CategorySearch.js on lines 129..132
                packages/web/src/components/search/DataSearch.js on lines 116..119

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

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

                        if (this.props.stream !== nextProps.stream) {
                            this.props.setStreaming(nextProps.componentId, nextProps.stream);
                        }
                Severity: Major
                Found in packages/maps/src/components/result/ReactiveMap.js and 3 other locations - About 35 mins to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 149..151
                packages/native/src/components/result/ReactiveList.js on lines 182..184
                packages/web/src/components/result/ReactiveList.js on lines 192..194

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 47.

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

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

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

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

                Refactorings

                Further Reading

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

                        const currentMapStyle
                            = this.mapStyles.find(style => style.label === props.defaultMapStyle)
                            || this.mapStyles[0];
                Severity: Minor
                Found in packages/maps/src/components/result/ReactiveMap.js and 1 other location - About 35 mins to fix
                packages/maps-native/src/components/maps/ReactiveMap.js on lines 57..59

                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