src/components/layout/content/DashBoard.js

Summary

Maintainability
F
3 days
Test Coverage

File DashBoard.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import styled, { css } from 'styled-components';
import { size, filter, map, flow, isEmpty, get } from 'lodash/fp';
Severity: Minor
Found in src/components/layout/content/DashBoard.js - About 5 hrs to fix

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

      render() {
        const {
          snippets,
          privateSnippets,
          starred,
    Severity: Major
    Found in src/components/layout/content/DashBoard.js - About 4 hrs to fix

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

                <HeadingWithSearch>
                  <h3>Tags:</h3>
                  <div>
                    <Icon type="search" size="22" color={ theme.baseAppColor }/>
                    <StyledInput
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 1 other location - About 3 hrs to fix
      src/components/layout/content/DashBoard.js on lines 373..382

      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

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

                  <HeadingWithSearch>
                    <h3>Starred:</h3>
                    <div>
                      <Icon type="search" size="22" color={ theme.baseAppColor }/>
                      <StyledInput
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 1 other location - About 3 hrs to fix
      src/components/layout/content/DashBoard.js on lines 390..399

      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

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

      DashBoard.propTypes = {
        snippets: PropTypes.object,
        theme: PropTypes.object,
        starred: PropTypes.number,
        searchByStatus: PropTypes.func,
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 2 other locations - About 3 hrs to fix
      src/components/common/controls/Button.js on lines 72..83
      src/components/layout/sidebar/Sidebar.js on lines 155..166

      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

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

                  <Public
                    style={ this.linearGradient(publicSnippetsCount) }
                    onClick={ () => searchByStatus('public') }
                    title="Click to filter public snippets">
                    <h3>Public</h3>
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 2 other locations - About 1 hr to fix
      src/components/layout/content/DashBoard.js on lines 310..316
      src/components/layout/content/DashBoard.js on lines 326..332

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

      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

                  <Private
                    style={ this.linearGradient(privateSnippets) }
                    onClick={ () => searchByStatus('private') }
                    title="Click to filter private snippets">
                    <h3>Private</h3>
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 2 other locations - About 1 hr to fix
      src/components/layout/content/DashBoard.js on lines 318..324
      src/components/layout/content/DashBoard.js on lines 326..332

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

      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

                  <Starred
                    style={ this.linearGradient(starred) }
                    onClick={ () => searchByStatus('starred') }
                    title="Click to filter starred snippets">
                    <h3>Starred</h3>
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 2 other locations - About 1 hr to fix
      src/components/layout/content/DashBoard.js on lines 310..316
      src/components/layout/content/DashBoard.js on lines 318..324

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

      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

                  <Truncated
                    style={ this.linearGradient(truncatedSnippets) }
                    onClick={ () => searchByTruncated() }
                    title="Click to filter snippets with large files">
                    <h3>Large</h3>
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 1 other location - About 1 hr to fix
      src/components/layout/content/DashBoard.js on lines 342..348

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

      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

                  <Untagged
                    style={ this.linearGradient(untaggedSnippets) }
                    onClick={ () => searchByUntagged() }
                    title="Click to filter snippets with no tags">
                    <h3>Untagged</h3>
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 1 other location - About 1 hr to fix
      src/components/layout/content/DashBoard.js on lines 334..340

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

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

      const Box = styled.div`
        background: ${(props) => props.theme.lightText};
        padding: 20px;
        border-radius: 3px;
        box-shadow: 0 0 10px ${(props) => props.theme.borderColor};
      Severity: Major
      Found in src/components/layout/content/DashBoard.js and 10 other locations - About 35 mins to fix
      src/components/common/controls/Checkbox.js on lines 5..38
      src/components/common/editor/Csv.js on lines 11..24
      src/components/layout/content/About.js on lines 27..32
      src/components/layout/content/settings/Base.js on lines 34..38
      src/components/layout/content/settings/Editor.js on lines 46..50
      src/components/layout/content/settings/Snippets.js on lines 47..51
      src/components/layout/headers/MainHeader.js on lines 29..40
      src/components/layout/headers/MainHeader.js on lines 69..83
      src/components/layout/headers/SnippetHeader.js on lines 74..83
      src/components/layout/sidebar/Sidebar.js on lines 39..45

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

      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