wikimedia/mediawiki-core

View on GitHub
includes/specials/SpecialAllPages.php

Summary

Maintainability
D
1 day
Test Coverage

Function showChunk has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    private function showChunk(
        $namespace = NS_MAIN, $from = null, $to = null, $hideredirects = false
    ) {
        $output = $this->getOutput();

Severity: Minor
Found in includes/specials/SpecialAllPages.php - About 5 hrs 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 showChunk has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function showChunk(
        $namespace = NS_MAIN, $from = null, $to = null, $hideredirects = false
    ) {
        $output = $this->getOutput();

Severity: Major
Found in includes/specials/SpecialAllPages.php - About 4 hrs to fix

    File SpecialAllPages.php has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
    Severity: Minor
    Found in includes/specials/SpecialAllPages.php - About 2 hrs to fix

      Method outputHTMLForm has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function outputHTMLForm( $namespace = NS_MAIN,
              $from = '', $to = '', $hideRedirects = false
          ) {
              $miserMode = (bool)$this->getConfig()->get( MainConfigNames::MiserMode );
              $formDescriptor = [
      Severity: Minor
      Found in includes/specials/SpecialAllPages.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return null;
        Severity: Major
        Found in includes/specials/SpecialAllPages.php - About 30 mins to fix

          Function getNamespaceKeyAndText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getNamespaceKeyAndText( $ns, $text ) {
                  if ( $text == '' ) {
                      # shortcut for common case
                      return [ $ns, '', '' ];
                  }
          Severity: Minor
          Found in includes/specials/SpecialAllPages.php - About 25 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

          There are no issues that match your filters.

          Category
          Status