appbaseio/dejaVu

View on GitHub
packages/browser/src/components/DataBrowser/AddFieldModal.js

Summary

Maintainability
F
3 days
Test Coverage

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

    render() {
        const { indexTypeMap } = this.props;
        const {
            addColumnError,
            addColumnField,
Severity: Major
Found in packages/browser/src/components/DataBrowser/AddFieldModal.js - About 6 hrs to fix

    File AddFieldModal.js has 377 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // @flow
    
    import React, { Component, Fragment } from 'react';
    import { Modal, Input, Select, Radio, Row, Col, Button } from 'antd';
    import { PlusOutlined } from '@ant-design/icons';
    Severity: Minor
    Found in packages/browser/src/components/DataBrowser/AddFieldModal.js - About 5 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      !addColumnError &&
                      addColumnField &&
                      selectedIndex &&
                      selectedType &&
      Severity: Major
      Found in packages/browser/src/components/DataBrowser/AddFieldModal.js - About 40 mins to fix

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

                            <Row>
                                <Col span={12}>
                                    <Item style={{ marginRight: '15px' }} label="Index">
                                        <Select
                                            defaultValue={selectedIndex}
        packages/browser/src/components/DataBrowser/AddRowModal.js on lines 240..278
        packages/browser/src/components/DataBrowser/ExportData.js on lines 358..396

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

        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 {
                    addColumnError,
                    addColumnField,
                    isColumnFieldValid,
                    selectedIndex,
        packages/browser/src/components/DataBrowser/ExportData.js on lines 306..318

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

        const mapStateToProps = state => ({
            appname: getAppname(state),
            mappings: getMappings(state),
            indexTypeMap: getIndexTypeMap(state),
            analyzers: getAnalyzers(state),
        packages/browser/src/components/DataBrowser/ExportData.js on lines 477..484
        packages/browser/src/components/DataBrowser/GlobalSearch.js on lines 111..118

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

        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

            handleIndexChange = selectedIndex => {
                this.setState({
                    selectedIndex,
                    types: this.props.indexTypeMap[selectedIndex],
                    selectedType: this.props.indexTypeMap[selectedIndex][0],
        packages/browser/src/components/DataBrowser/AddRowModal.js on lines 165..171

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

        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

            toggleModal = () => {
                this.setState(prevState => ({
                    isShowingModal: !prevState.isShowingModal,
                }));
                this.props.setMode(MODES.EDIT);
        packages/browser/src/components/DataBrowser/AddRowModal.js on lines 179..184

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

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

                    const {
                        addColumnError,
                        addColumnField,
                        addColumnMapping,
                        selectedIndex,
        Severity: Major
        Found in packages/browser/src/components/DataBrowser/AddFieldModal.js and 6 other locations - About 35 mins to fix
        packages/browser/src/components/ConnectApp/ConnectApp.js on lines 447..455
        packages/browser/src/components/DataBrowser/AddRowModal.js on lines 134..142
        packages/browser/src/components/DataBrowser/DataBrowser.js on lines 75..83
        packages/browser/src/components/DataBrowser/UpdateRow.js on lines 81..89
        packages/browser/src/components/DataTable/DataGrid.js on lines 120..128
        packages/browser/src/components/DataTable/DataGrid.js on lines 170..178

        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