wikimedia/mediawiki-core

View on GitHub
includes/Output/OutputPage.php

Summary

Maintainability
F
2 wks
Test Coverage

File OutputPage.php has 2401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Preparation for the final page rendering.
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/Output/OutputPage.php - About 6 days to fix

    OutputPage has 199 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OutputPage extends ContextSource {
        use ProtectedHookAccessorTrait;
    
        /** Output CSP policies as headers */
        public const CSP_HEADERS = 'headers';
    Severity: Major
    Found in includes/Output/OutputPage.php - About 3 days to fix

      Function output has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          public function output( $return = false ) {
              if ( $this->mDoNothing ) {
                  return $return ? '' : null;
              }
      
      
      Severity: Minor
      Found in includes/Output/OutputPage.php - About 6 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 getJSVars has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getJSVars( ?int $flag = null ) {
              $curRevisionId = 0;
              $articleId = 0;
              $canonicalSpecialPageName = false; # T23115
              $services = MediaWikiServices::getInstance();
      Severity: Major
      Found in includes/Output/OutputPage.php - About 4 hrs to fix

        Method getHeadLinksArray has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getHeadLinksArray() {
                $tags = [];
                $config = $this->getConfig();
        
                if ( $this->cspOutputMode === self::CSP_META ) {
        Severity: Major
        Found in includes/Output/OutputPage.php - About 4 hrs to fix

          Function addParserOutputMetadata has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addParserOutputMetadata( ParserOutput $parserOutput ) {
                  // T301020 This should eventually use the standard "merge ParserOutput"
                  // function between $parserOutput and $this->metadata.
                  $this->mLanguageLinks =
                      array_merge( $this->mLanguageLinks, $parserOutput->getLanguageLinks() );
          Severity: Minor
          Found in includes/Output/OutputPage.php - About 4 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 output has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function output( $return = false ) {
                  if ( $this->mDoNothing ) {
                      return $return ? '' : null;
                  }
          
          
          Severity: Major
          Found in includes/Output/OutputPage.php - About 4 hrs to fix

            Method addParserOutputMetadata has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function addParserOutputMetadata( ParserOutput $parserOutput ) {
                    // T301020 This should eventually use the standard "merge ParserOutput"
                    // function between $parserOutput and $this->metadata.
                    $this->mLanguageLinks =
                        array_merge( $this->mLanguageLinks, $parserOutput->getLanguageLinks() );
            Severity: Major
            Found in includes/Output/OutputPage.php - About 3 hrs to fix

              Function getJSVars has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getJSVars( ?int $flag = null ) {
                      $curRevisionId = 0;
                      $articleId = 0;
                      $canonicalSpecialPageName = false; # T23115
                      $services = MediaWikiServices::getInstance();
              Severity: Minor
              Found in includes/Output/OutputPage.php - About 3 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

              Function getHeadLinksArray has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getHeadLinksArray() {
                      $tags = [];
                      $config = $this->getConfig();
              
                      if ( $this->cspOutputMode === self::CSP_META ) {
              Severity: Minor
              Found in includes/Output/OutputPage.php - About 3 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

              Function addCategoryLinks has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function addCategoryLinks( array $categories ) {
                      if ( !$categories ) {
                          return;
                      }
              
              
              Severity: Minor
              Found in includes/Output/OutputPage.php - About 3 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

              Function showPermissionsErrorPage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function showPermissionsErrorPage( array $errors, $action = null ) {
                      $services = MediaWikiServices::getInstance();
                      $groupPermissionsLookup = $services->getGroupPermissionsLookup();
                      foreach ( $errors as $key => $error ) {
                          $errors[$key] = (array)$error;
              Severity: Minor
              Found in includes/Output/OutputPage.php - About 2 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 checkLastModified has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function checkLastModified( $timestamp ) {
                      if ( !$timestamp || $timestamp == '19700101000000' ) {
                          wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP" );
                          return false;
                      }
              Severity: Major
              Found in includes/Output/OutputPage.php - About 2 hrs to fix

                Method showPermissionsErrorPage has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function showPermissionsErrorPage( array $errors, $action = null ) {
                        $services = MediaWikiServices::getInstance();
                        $groupPermissionsLookup = $services->getGroupPermissionsLookup();
                        foreach ( $errors as $key => $error ) {
                            $errors[$key] = (array)$error;
                Severity: Major
                Found in includes/Output/OutputPage.php - About 2 hrs to fix

                  Method getRlClient has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getRlClient() {
                          if ( !$this->rlClient ) {
                              $context = $this->getRlClientContext();
                              $rl = $this->getResourceLoader();
                              $this->addModules( [
                  Severity: Major
                  Found in includes/Output/OutputPage.php - About 2 hrs to fix

                    Method getHeadLinksSyndicationArray has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getHeadLinksSyndicationArray( Config $config ) {
                            if ( !$config->get( MainConfigNames::Feed ) ) {
                                return [];
                            }
                    
                    
                    Severity: Major
                    Found in includes/Output/OutputPage.php - About 2 hrs to fix

                      Method sendCacheControl has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function sendCacheControl() {
                              $response = $this->getRequest()->response();
                              $config = $this->getConfig();
                      
                              $this->addVaryHeader( 'Cookie' );
                      Severity: Major
                      Found in includes/Output/OutputPage.php - About 2 hrs to fix

                        Method headElement has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function headElement( Skin $sk, $includeStyle = true ) {
                                $config = $this->getConfig();
                                $userdir = $this->getLanguage()->getDir();
                                $services = MediaWikiServices::getInstance();
                                $sitedir = $services->getContentLanguage()->getDir();
                        Severity: Minor
                        Found in includes/Output/OutputPage.php - About 2 hrs to fix

                          Function sendCacheControl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function sendCacheControl() {
                                  $response = $this->getRequest()->response();
                                  $config = $this->getConfig();
                          
                                  $this->addVaryHeader( 'Cookie' );
                          Severity: Minor
                          Found in includes/Output/OutputPage.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 getHeadLinksAlternateURLsArray has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function getHeadLinksAlternateURLsArray() {
                                  $tags = [];
                                  $languageUrls = [];
                                  $action = $this->getContext()->getActionName();
                                  $isCanonicalUrlAction = in_array( $action, [ 'history', 'info' ] );
                          Severity: Minor
                          Found in includes/Output/OutputPage.php - About 1 hr to fix

                            Method addCategoryLinks has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function addCategoryLinks( array $categories ) {
                                    if ( !$categories ) {
                                        return;
                                    }
                            
                            
                            Severity: Minor
                            Found in includes/Output/OutputPage.php - About 1 hr to fix

                              Method getRlClientContext has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function getRlClientContext() {
                                      if ( !$this->rlClientContext ) {
                                          $query = ResourceLoader::makeLoaderQuery(
                                              [], // modules; not relevant
                                              $this->getLanguage()->getCode(),
                              Severity: Minor
                              Found in includes/Output/OutputPage.php - About 1 hr to fix

                                Method getHeadLinksCanonicalURLArray has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function getHeadLinksCanonicalURLArray( Config $config ) {
                                        $tags = [];
                                        $canonicalUrl = $this->mCanonicalUrl;
                                
                                        if ( $config->get( MainConfigNames::EnableCanonicalServerLink ) ) {
                                Severity: Minor
                                Found in includes/Output/OutputPage.php - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if ( in_array( $action, [ 'read', 'edit', 'createpage', 'createtalk', 'upload' ] )
                                              && !$this->getUser()->isNamed() && count( $errors ) == 1 && isset( $errors[0][0] )
                                              && ( $errors[0][0] == 'badaccess-groups' || $errors[0][0] == 'badaccess-group0' )
                                              && ( $groupPermissionsLookup->groupHasPermission( 'user', $action )
                                                  || $groupPermissionsLookup->groupHasPermission( 'autoconfirmed', $action ) )
                                  Severity: Critical
                                  Found in includes/Output/OutputPage.php - About 1 hr to fix

                                    Function getHeadLinksCopyrightArray has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        private function getHeadLinksCopyrightArray( Config $config ) {
                                            $tags = [];
                                    
                                            if ( $this->copyrightUrl !== null ) {
                                                $copyright = $this->copyrightUrl;
                                    Severity: Minor
                                    Found in includes/Output/OutputPage.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 getHeadLinksCanonicalURLArray has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        private function getHeadLinksCanonicalURLArray( Config $config ) {
                                            $tags = [];
                                            $canonicalUrl = $this->mCanonicalUrl;
                                    
                                            if ( $config->get( MainConfigNames::EnableCanonicalServerLink ) ) {
                                    Severity: Minor
                                    Found in includes/Output/OutputPage.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 styleLink has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function styleLink( $style, array $options ) {
                                            if ( isset( $options['dir'] ) && $this->getLanguage()->getDir() != $options['dir'] ) {
                                                return '';
                                            }
                                    
                                    
                                    Severity: Minor
                                    Found in includes/Output/OutputPage.php - About 1 hr to fix

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

                                          public function checkLastModified( $timestamp ) {
                                              if ( !$timestamp || $timestamp == '19700101000000' ) {
                                                  wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP" );
                                                  return false;
                                              }
                                      Severity: Minor
                                      Found in includes/Output/OutputPage.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 styleLink has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          protected function styleLink( $style, array $options ) {
                                              if ( isset( $options['dir'] ) && $this->getLanguage()->getDir() != $options['dir'] ) {
                                                  return '';
                                              }
                                      
                                      
                                      Severity: Minor
                                      Found in includes/Output/OutputPage.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 getContentLangForJS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private function getContentLangForJS(): Language {
                                              if ( !$this->contentLang ) {
                                                  // If this is not set, then we're likely not on in a request that renders page content
                                                  // (e.g. ViewAction or ApiParse), but rather a different Action or SpecialPage.
                                                  // In that case there isn't a main ParserOutput object to represent the page or output.
                                      Severity: Minor
                                      Found in includes/Output/OutputPage.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 getHeadLinksSyndicationArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private function getHeadLinksSyndicationArray( Config $config ) {
                                              if ( !$config->get( MainConfigNames::Feed ) ) {
                                                  return [];
                                              }
                                      
                                      
                                      Severity: Minor
                                      Found in includes/Output/OutputPage.php - About 45 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

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

                                              $text, PageReference $title, $linestart, $interface, $wrapperClass = null
                                      Severity: Minor
                                      Found in includes/Output/OutputPage.php - About 35 mins to fix

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

                                                $title, $msg, $params = [], $returnto = null, $returntoquery = null
                                        Severity: Minor
                                        Found in includes/Output/OutputPage.php - About 35 mins to fix

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

                                              private function getHeadLinksAlternateURLsArray() {
                                                  $tags = [];
                                                  $languageUrls = [];
                                                  $action = $this->getContext()->getActionName();
                                                  $isCanonicalUrlAction = in_array( $action, [ 'history', 'info' ] );
                                          Severity: Minor
                                          Found in includes/Output/OutputPage.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 buildExemptModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              protected function buildExemptModules() {
                                                  $chunks = [];
                                          
                                                  // Requirements:
                                                  // - Within modules provided by the software (core, skin, extensions),
                                          Severity: Minor
                                          Found in includes/Output/OutputPage.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 loadSkinModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public function loadSkinModules( $sk ) {
                                                  foreach ( $sk->getDefaultModules() as $group => $modules ) {
                                                      if ( $group === 'styles' ) {
                                                          foreach ( $modules as $moduleMembers ) {
                                                              $this->addModuleStyles( $moduleMembers );
                                          Severity: Minor
                                          Found in includes/Output/OutputPage.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

                                          Avoid too many return statements within this method.
                                          Open

                                                  return true;
                                          Severity: Major
                                          Found in includes/Output/OutputPage.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                    return true;
                                            Severity: Major
                                            Found in includes/Output/OutputPage.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return false;
                                              Severity: Major
                                              Found in includes/Output/OutputPage.php - About 30 mins to fix

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

                                                    public function prepareErrorPage( $pageTitle = null, $htmlTitle = false ) {
                                                        if ( $pageTitle !== null || $htmlTitle !== false ) {
                                                            wfDeprecated( __METHOD__ . ' with explicit arguments', '1.41' );
                                                            if ( $pageTitle !== null ) {
                                                                $this->setPageTitle( $pageTitle );
                                                Severity: Minor
                                                Found in includes/Output/OutputPage.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

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

                                                    public function formatPermissionsErrorMessage( array $errors, $action = null ) {
                                                        if ( $action == null ) {
                                                            $text = $this->msg( 'permissionserrorstext', count( $errors ) )->plain() . "\n\n";
                                                        } else {
                                                            $action_desc = $this->msg( "action-$action" )->plain();
                                                Severity: Minor
                                                Found in includes/Output/OutputPage.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