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()
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()
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"
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) => {
- Read upRead up
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)
/**
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"
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
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"
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)
/**
- Read upRead up
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)
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"
Function verifyAsync
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
const verifyAsync = async () => {
if (!accessToken) {
setIsLoggedIn(false)
return
}
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"
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)
- Read upRead up
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"
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"
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`,
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)
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(
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,