bnomei/kirby3-redirects

View on GitHub

Showing 5 of 7 total issues

Method checkForRedirect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkForRedirect(): ?Redirect
    {
        $map = $this->option('redirects');

        // add block to map
Severity: Minor
Found in classes/Redirects.php - About 1 hr to fix

    Function checkForRedirect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkForRedirect(): ?Redirect
        {
            $map = $this->option('redirects');
    
            // add block to map
    Severity: Minor
    Found in classes/Redirects.php - 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 remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function remove(array $change): bool
        {
            if (is_array($change) &&
                count($change) === count($change, COUNT_RECURSIVE)
            ) {
    Severity: Minor
    Found in classes/Redirects.php - 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 updateRedirects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateRedirects(array $data): bool
        {
            $map = $this->option('map');
            if (is_a($map, Field::class)) {
                $page = $map->parent();
    Severity: Minor
    Found in classes/Redirects.php - 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 matches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function matches(string $url): bool
        {
            $from = rtrim($this->from(), '/');
    
            // plain string
    Severity: Minor
    Found in classes/Redirect.php - 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