Showing 70 of 194 total issues
Function Layout2
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const Layout2: React.FC<Props> = ({ location, title, children }) => {
const rootPath: string = `${__PATH_PREFIX__}/`
const isAppPage = location.pathname.startsWith("/app")
const isAuthPage = location.pathname.startsWith("/auth")
const isHomePage = location.pathname === rootPath
- 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 Header
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const Header: React.FC<HeaderProps> = ({ location, title = "default" }) => {
const rootPath: string = `${__PATH_PREFIX__}/`
const isAppPage = location.pathname.startsWith("/app")
const isAuthPage = location.pathname.startsWith("/auth")
const isHomePage = location.pathname === rootPath
- 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 ThemeSlider
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ThemeSlider = () => {
const isDarkMode = useSelector((state: RootState) => state.isDarkMode)
const dispatch = useDispatch()
const [moonProps, setMoonProps] = useSpring(() => ({
Function combineTagGroups
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const combineTagGroups = (
markdownRemarkGroup: Array<Group>,
contentfulBlogPostGroup: Array<Group>
) => {
let result: Array<Group> = []
- 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 BlogPostTemplate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function BlogPostTemplate({ data, pageContext, location }) {
const post = data.markdownRemark
const { title: siteTitle } = data.site.siteMetadata
const {
previous,
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function AttackAnimationSimulator(props: PageProps) {
const { data } = props
const siteTitle = data.site.siteMetadata.title
const isDarkMode = useSelector((state) => state.isDarkMode)
- 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 Tree
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
({ children, name, style, defaultOpen = false, onClick }: TreeProps) => {
const [isOpen, setOpen] = useState(defaultOpen)
const previous = usePrevious(isOpen)
- 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 SwipeableTemporaryDrawer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const SwipeableTemporaryDrawer = () => {
const classes = useStyles()
const [open, setOpen] = useState(false)
const { enqueueSnackbar } = useSnackbar()
- 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 SvgTrail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const SvgTrail: React.ComponentType = ({ children }) => {
/** instance variables */
const slowMoRef = useRef(false)
const showTrailRef = useRef(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 V2Unmemoized
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const V2Unmemoized: React.FC<Props> = ({
linkTo,
date,
title,
description,
- 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 CreateComment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const CreateComment = ({ url }) => {
const { currentUserId } = useAuthentication()
const [state, dispatch] = useReducer(commentReducer, { body: "" })
const [
- 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 CommentsByUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const CommentsByUrl = ({ url }) => {
const { currentUserId } = useAuthentication()
const [
getCommentsByUrl,
{
- 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 AuthVerify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const AuthVerify = ({ location }: PageProps) => {
const { enqueueSnackbar } = useSnackbar()
const { session, email } = useSelector((s: RootState) => ({
session: s.cognito?.data?.Session,
email: s.cognito?.data?.ChallengeParameters?.email,
- 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 PageViewCounter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const PageViewCounter = ({ location }: { location: Location }) => {
const [getPageViews, { called, loading, data, error }] = useLazyQuery(
GET_PAGE
)
const client = useApolloClient()
- 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 Button
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const Button: React.FC<Props> = (props) => {
const [springProps, set] = useSpring(() => ({
from: { ...FROM_STYLE },
config: config.stiff,
}))
- 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 useWindowScrollPercent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const useWindowScrollPercent = (): [OpaqueInterpolation<number>] => {
const [{ scrollPercent }, setScrollProps] = useSpring(() => ({
scrollPercent: 0,
}))
- 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 timeDifference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function timeDifference(current, previous) {
const milliSecondsPerMinute = 60 * 1000
const milliSecondsPerHour = milliSecondsPerMinute * 60
const milliSecondsPerDay = milliSecondsPerHour * 24
const milliSecondsPerMonth = milliSecondsPerDay * 30
- 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
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
if (!data?.getPage.attributes) return <Small>oops</Small>
Avoid too many return
statements within this function. Open
return