bnomei/kirby3-redirects

View on GitHub

Showing 6 of 6 total issues

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

public function checkForRedirect(): ?Redirect
{
$requesturi = (string) $this->options['request.uri'];
if (static::isKnownValidRoute($requesturi)) {
return null;
Severity: Minor
Found in classes/Redirects.php - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    'drupal' => [
    ['fromuri' => 'user/login', 'touri' => '', 'code' => 404],
    ['fromuri' => 'user/register', 'touri' => '', 'code' => 404],
    ['fromuri' => 'admin\/.*', 'touri' => '', 'code' => 404], // catch-all (1)
    // ['fromuri' => 'admin/config', 'touri' => '', 'code' => 404],
    Severity: Major
    Found in index.php and 1 other location - About 1 hr to fix
    index.php on lines 61..69

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    'joomla' => [
    ['fromuri' => 'administrator/index.php', 'touri' => '', 'code' => 404],
    ['fromuri' => 'administrator\/components\/.*', 'touri' => '', 'code' => 404],
    ['fromuri' => 'components\/com_users\/.*', 'touri' => '', 'code' => 404],
    ['fromuri' => 'components\/com_content\/.*', 'touri' => '', 'code' => 404],
    Severity: Major
    Found in index.php and 1 other location - About 1 hr to fix
    index.php on lines 70..80

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

    public function checkForRedirect(): ?Redirect
    {
    $requesturi = (string) $this->options['request.uri'];
    if (static::isKnownValidRoute($requesturi)) {
    return null;
    Severity: Minor
    Found in classes/Redirects.php - About 55 mins to fix

    Function remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    public function remove(array $change): bool
    {
    // wrap single change in array of changes
    if (count($change) === count($change, COUNT_RECURSIVE)) {
    $change = [$change];
    Severity: Minor
    Found in classes/Redirects.php - About 55 mins to fix

    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
    Severity
    Category
    Status
    Source
    Language