anephenix/ui

View on GitHub

Showing 3 of 17 total issues

Function MenuItem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const MenuItem = ({
    text,
    id,
    className,
    url,
Severity: Minor
Found in src/components/menu-item/MenuItem.jsx - 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 render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        const { Component, pageProps } = this.props;
        const logo = (
            <Link href="/">
                <div
Severity: Minor
Found in pages/_app.js - About 1 hr to fix

    Function handleErrors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const handleErrors = (setError, err) => {
        const errors = [];
        if (err && err.response && err.response.data && err.response.data.errors) {
            // eslint-disable-next-line no-unused-vars
            for (const key in err.response.data.errors) {
    Severity: Minor
    Found in index.jsx - 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

    Severity
    Category
    Status
    Source
    Language