thiskevinwang/coffee-code-climb

View on GitHub

Showing 70 of 194 total issues

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

      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

        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

                Function AttackAnimationSimulator has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function AttackAnimationSimulator(props: PageProps) {
                  const { data } = props
                  const siteTitle = data.site.siteMetadata.title
                
                  const isDarkMode = useSelector((state) => state.isDarkMode)
                Severity: Major
                Found in src/pages/attack-animation-simulator.tsx - About 4 hrs to fix

                  File useCognito.ts has 332 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { useCallback } from "react"
                  import { useDispatch, useSelector } from "react-redux"
                  import _ from "lodash"
                  import type { CognitoIdentityServiceProvider } from "aws-sdk"
                  import type { Dispatch } from "redux"
                  Severity: Minor
                  Found in src/utils/Playground/useCognito.ts - About 4 hrs to fix

                    Function verifyAsync has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        const verifyAsync = async () => {
                          if (!accessToken) {
                            setIsLoggedIn(false)
                            return
                          }
                    Severity: Major
                    Found in src/utils/useVerifyTokenSet.ts - About 3 hrs to fix

                      File NavBar2.tsx has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React from "react"
                      import { useSelector, useDispatch } from "react-redux"
                      import { Link, navigate } from "gatsby"
                      import { useSnackbar } from "notistack"
                      import { useApolloClient, gql } from "@apollo/client"
                      Severity: Minor
                      Found in src/components/Layout2Components/NavBar2.tsx - About 3 hrs to fix

                        Function PostsManager has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const PostsManager = ({ allPosts, location }: PostsManagerProps) => {
                          const postsVersion = useSelector((state) => state.postsVersion)
                          const posts = useMemo(() => generatePosts(allPosts), [allPosts])
                        
                          const [items, setItems] = useState(() => posts)
                        Severity: Minor
                        Found in src/components/PostsManager/PostsManager.tsx - About 3 hrs to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        File PostsManager.tsx has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { useState, useEffect, useCallback, useMemo } from "react"
                        import { PageProps } from "gatsby"
                        import { useSelector } from "react-redux"
                        import _ from "lodash"
                        import styled from "styled-components"
                        Severity: Minor
                        Found in src/components/PostsManager/PostsManager.tsx - About 3 hrs to fix

                          File app.tsx has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { useEffect } from "react"
                          import ms from "ms"
                          import { useLazyQuery, gql } from "@apollo/client"
                          import { navigate, PageProps, Link } from "gatsby"
                          import { Router } from "@reach/router"
                          Severity: Minor
                          Found in src/pages/app.tsx - About 2 hrs to fix

                            Function overrideThemeStyles has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            Wordpress2016.overrideThemeStyles = (a, b) => {
                              // console.log("a", a, "b", b)
                              return {
                                "a.gatsby-resp-image-link": {
                                  boxShadow: `none`,
                            Severity: Major
                            Found in src/utils/typography/index.tsx - About 2 hrs to fix

                              Function Discussions has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const Discussions = (props: RouteComponentProps) => {
                                const { data, fetchMore } = useQuery<{
                                  getDiscussions: Query["getDiscussions"]
                                }>(GET_DISCUSSIONS_QUERY)
                              
                              
                              Severity: Major
                              Found in src/components/App/Discussions.tsx - About 2 hrs to fix

                                Function LayoutManager has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const LayoutManager: React.FC<Props> = (props) => {
                                  const { pathname } = props.location
                                  const [showModal, setShowModal] = useState(false)
                                  const [shouldExit, setShouldExit] = useState(false)
                                  const [neverShowModalChecked, toggleNeverShowModalChecked] = useReducer(
                                Severity: Major
                                Found in src/components/layoutManager.tsx - About 2 hrs to fix

                                  Function arr has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    const arr: Arr[] = ARRAY_FROM_DIVISIONS.map(e => {
                                      const [isIntersecting, bind] = useIO({
                                        root: null,
                                        rootMargin: `-100px 0px 100%`,
                                        threshold: 0.99,
                                  Severity: Major
                                  Found in src/components/StickyNumbers/index.tsx - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language