thiskevinwang/coffee-code-climb

View on GitHub

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
Severity: Minor
Found in src/components/layout2.tsx - About 1 hr 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 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
Severity: Minor
Found in src/components/Header/index.tsx - About 1 hr 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 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(() => ({
Severity: Minor
Found in src/components/ThemeSlider/index.tsx - About 1 hr to fix

    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> = []
    Severity: Minor
    Found in src/utils/combineTagGroups/index.tsx - About 55 mins 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 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,
    Severity: Minor
    Found in src/templates/blog-post.tsx - About 55 mins 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 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)
    Severity: Minor
    Found in src/pages/attack-animation-simulator.tsx - About 55 mins 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 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)
    
    
    Severity: Minor
    Found in src/components/Tree/index.tsx - About 55 mins 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 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()
    
    
    Severity: Minor
    Found in src/components/SwipeableTemporaryDrawer/index.tsx - About 45 mins 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 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)
    
    
    Severity: Minor
    Found in src/components/SvgTrail/index.tsx - About 45 mins 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 V2Unmemoized has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const V2Unmemoized: React.FC<Props> = ({
      linkTo,
      date,
      title,
      description,
    Severity: Minor
    Found in src/components/Posts/V2.tsx - About 45 mins 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 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 [
    Severity: Minor
    Found in src/components/Comments/Create/index.tsx - About 35 mins 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 CommentsByUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const CommentsByUrl = ({ url }) => {
      const { currentUserId } = useAuthentication()
      const [
        getCommentsByUrl,
        {
    Severity: Minor
    Found in src/components/Comments/Display/ByUrl/index.tsx - About 35 mins 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 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,
    Severity: Minor
    Found in src/pages/auth/verify.tsx - About 35 mins 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 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()
    Severity: Minor
    Found in src/components/PageViewCounter/index.tsx - About 35 mins 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 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,
      }))
    Severity: Minor
    Found in src/components/Button/index.tsx - About 35 mins 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 useWindowScrollPercent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useWindowScrollPercent = (): [OpaqueInterpolation<number>] => {
      const [{ scrollPercent }, setScrollProps] = useSpring(() => ({
        scrollPercent: 0,
      }))
    
    
    Severity: Minor
    Found in src/hooks/useWindowScrollPercent.ts - About 35 mins 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 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
    Severity: Minor
    Found in src/pages/rds.tsx - About 35 mins 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

    Avoid too many return statements within this function.
    Open

                return
    Severity: Major
    Found in src/utils/useVerifyTokenSet.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        if (!data?.getPage.attributes) return <Small>oops</Small>
      Severity: Major
      Found in src/components/PageViewCounter/index.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return
        Severity: Major
        Found in src/utils/useVerifyTokenSet.ts - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language