wikimedia/mediawiki-core

View on GitHub
includes/specialpage/SpecialPage.php

Summary

Maintainability
D
2 days
Test Coverage

SpecialPage has 70 functions (exceeds 20 allowed). Consider refactoring.
Open

class SpecialPage implements MessageLocalizer {
    /**
     * @var string The canonical name of this special page
     * Also used as the message key for the default <h1> heading,
     * @see getDescription()
Severity: Major
Found in includes/specialpage/SpecialPage.php - About 1 day to fix

    File SpecialPage.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Parent class for all special pages.
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in includes/specialpage/SpecialPage.php - About 7 hrs to fix

      Method checkLoginSecurityLevel has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function checkLoginSecurityLevel( $level = null ) {
              $level = $level ?: $this->getName();
              $key = 'SpecialPage:reauth:' . $this->getName();
              $request = $this->getRequest();
      
      
      Severity: Minor
      Found in includes/specialpage/SpecialPage.php - About 1 hr to fix

        Function checkLoginSecurityLevel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function checkLoginSecurityLevel( $level = null ) {
                $level = $level ?: $this->getName();
                $key = 'SpecialPage:reauth:' . $this->getName();
                $request = $this->getRequest();
        
        
        Severity: Minor
        Found in includes/specialpage/SpecialPage.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

        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $name = '', $restriction = '', $listed = true,
                $function = false, $file = '', $includable = false
        Severity: Minor
        Found in includes/specialpage/SpecialPage.php - About 45 mins to fix

          Method buildPrevNextNavigation has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $offset,
                  $limit,
                  array $query = [],
                  $atend = false,
                  $subpage = false
          Severity: Minor
          Found in includes/specialpage/SpecialPage.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status