thiskevinwang/coffee-code-climb

View on GitHub

Showing 194 of 194 total issues

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

            <ListItem
              onClick={(e) => e.preventDefault()}
              component="div"
              disableRipple
              classes={{ root: classes.menuItemRoot }}
Severity: Major
Found in src/components/SwipeableTemporaryDrawer/index.tsx and 1 other location - About 1 day to fix
src/components/Layout2Components/NavBar2.tsx on lines 287..316

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

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

              <MenuItem disableRipple classes={{ root: classes.menuItemRoot }}>
                <Box marginRight={1.5}>Theme:</Box>
                <Box position="relative">
                  <NativeSelect
                    value={isDarkMode ? "dark" : "light"}
Severity: Major
Found in src/components/Layout2Components/NavBar2.tsx and 1 other location - About 1 day to fix
src/components/SwipeableTemporaryDrawer/index.tsx on lines 148..182

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

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

Function NavBar2 has 210 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NavBar2 = () => {
  const theme = useTheme()
  const xsDown = useMediaQuery(theme.breakpoints.down("xs"))

  const { enqueueSnackbar } = useSnackbar()
Severity: Major
Found in src/components/Layout2Components/NavBar2.tsx - About 1 day to fix

    Function SwipeableTemporaryDrawer has 157 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const SwipeableTemporaryDrawer = () => {
      const classes = useStyles()
      const [open, setOpen] = useState(false)
      const { enqueueSnackbar } = useSnackbar()
    
    
    Severity: Major
    Found in src/components/SwipeableTemporaryDrawer/index.tsx - About 6 hrs to fix

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

            <fs.Fieldset>
              <fs.Content>
                <fs.Title>Your Email</fs.Title>
                <fs.Subtitle>
                  Please enter the email address you want to use to log in with
      Severity: Major
      Found in src/components/App/Settings.tsx and 1 other location - About 6 hrs to fix
      src/components/App/Settings.tsx on lines 182..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 160.

      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

            <fs.Fieldset>
              <fs.Content>
                <fs.Title>Your Name</fs.Title>
                <fs.Subtitle>
                  Please enter your full name, or a display name you are comfortable
      Severity: Major
      Found in src/components/App/Settings.tsx and 1 other location - About 6 hrs to fix
      src/components/App/Settings.tsx on lines 196..208

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

      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

                  update: (cache, { data: { createComment } }) => {
                    const previous = cache.readQuery<{
                      getDiscussionById: Query["getDiscussionById"]
                    }>({
                      query: GET_DISCUSSION_BY_ID_QUERY,
      Severity: Major
      Found in src/components/App/Discussion.tsx and 1 other location - About 5 hrs to fix
      src/components/App/Discussion.tsx on lines 311..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 153.

      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

                              update: (cache, { data: { createComment } }) => {
                                const previous = cache.readQuery<{
                                  getDiscussionById: Query["getDiscussionById"]
                                }>({
                                  query: GET_DISCUSSION_BY_ID_QUERY,
      Severity: Major
      Found in src/components/App/Discussion.tsx and 1 other location - About 5 hrs to fix
      src/components/App/Discussion.tsx on lines 399..422

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

      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

            update: (item) => {
              return {
                opacity: 1,
                ...handleAnimation(item),
                scale: 1,
      Severity: Major
      Found in src/components/PostsManager/PostsManager.tsx and 1 other location - About 5 hrs to fix
      src/components/PostsManager/PostsManager.tsx on lines 92..105

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

      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

            enter: (item) => {
              return {
                opacity: 1,
                ...handleAnimation(item),
                scale: 1,
      Severity: Major
      Found in src/components/PostsManager/PostsManager.tsx and 1 other location - About 5 hrs to fix
      src/components/PostsManager/PostsManager.tsx on lines 106..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 152.

      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 Discussion.tsx has 400 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { useState } from "react"
      import ms from "ms"
      import styled from "styled-components"
      import { Editor, EditorState, convertFromRaw, convertToRaw } from "draft-js"
      import { navigate, RouteComponentProps } from "@reach/router"
      Severity: Minor
      Found in src/components/App/Discussion.tsx - About 5 hrs to fix

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

            {
              from: item => ({
                opacity: 0,
                transform: `scale(0.8)`,
                filter: `blur(10px)`,
        Severity: Major
        Found in src/hooks/rds/useCommentLogic.ts and 1 other location - About 5 hrs to fix
        src/components/Comments/Display/ByUrl/index.tsx on lines 127..149

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

        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

            {
              from: (item) => ({
                opacity: 0,
                transform: `scale(0.8)`,
                filter: `blur(10px)`,
        Severity: Major
        Found in src/components/Comments/Display/ByUrl/index.tsx and 1 other location - About 5 hrs to fix
        src/hooks/rds/useCommentLogic.ts on lines 142..164

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

        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

        Function TableOfContents has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        const TableOfContents: React.FC<TableOfContentsProps> = ({ title, __html }) => {
          const [{ top }, set] = useSpring(() => ({ top: 0 }))
        
          const bindScrollGesture = useScroll(
            (state) => {
        Severity: Minor
        Found in src/components/TableOfContents.tsx - About 5 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 StickyNumbers has 130 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const StickyNumbers = () => {
          const [isScrolling, setIsScrolling] = React.useState(false)
          const [isHovering, setIsHovering] = React.useState(false)
        
          /**
        Severity: Major
        Found in src/components/StickyNumbers/index.tsx - About 5 hrs to fix

          File terms.tsx has 367 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from "react"
          import { graphql, PageProps } from "gatsby"
          
          import { LayoutManager } from "components/layoutManager"
          import SEO from "components/seo"
          Severity: Minor
          Found in src/pages/terms.tsx - About 4 hrs to fix

            Function useVerifyTokenSet has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const useVerifyTokenSet = () => {
              const dispatch = useDispatch()
            
              const cog = useSelector((state: RootState) => state.cognito)
              const accessToken = cog.data?.AuthenticationResult?.AccessToken
            Severity: Major
            Found in src/utils/useVerifyTokenSet.ts - About 4 hrs to fix

              File blog-post.tsx has 350 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { useState, memo } from "react"
              import { Link, graphql } from "gatsby"
              import _ from "lodash"
              import styled, { css } from "styled-components"
              import theme from "styled-theming"
              Severity: Minor
              Found in src/templates/blog-post.tsx - About 4 hrs to fix

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

                const StickyNumbers = () => {
                  const [isScrolling, setIsScrolling] = React.useState(false)
                  const [isHovering, setIsHovering] = React.useState(false)
                
                  /**
                Severity: Minor
                Found in src/components/StickyNumbers/index.tsx - 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

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

                  const UserTooltip = () => (
                    <Box p="var(--geist-gap-half)">
                      <Avatar src={avatar_url} />
                      <Box flexDirection="row">
                        <h3>{name}</h3>
                Severity: Major
                Found in src/components/MapIdToUser/index.tsx and 1 other location - About 4 hrs to fix
                src/components/MapIdToUser/index.tsx on lines 25..34

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

                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