wikimedia/mediawiki-core

View on GitHub
includes/specials/SpecialVersion.php

Summary

Maintainability
F
1 wk
Test Coverage

File SpecialVersion.php has 960 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Copyright © 2005 Ævar Arnfjörð Bjarmason
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/specials/SpecialVersion.php - About 2 days to fix

    Function getCreditsForExtension has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCreditsForExtension( $type, array $extension ) {
            $out = $this->getOutput();
    
            // We must obtain the information for all the bits and pieces!
            // ... such as extension names and links
    Severity: Minor
    Found in includes/specials/SpecialVersion.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

    Function execute has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute( $par ) {
            $config = $this->getConfig();
            $credits = self::getCredits( ExtensionRegistry::getInstance(), $config );
    
            $this->setHeaders();
    Severity: Minor
    Found in includes/specials/SpecialVersion.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 getCreditsForExtension has 135 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getCreditsForExtension( $type, array $extension ) {
            $out = $this->getOutput();
    
            // We must obtain the information for all the bits and pieces!
            // ... such as extension names and links
    Severity: Major
    Found in includes/specials/SpecialVersion.php - About 5 hrs to fix

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

          public function execute( $par ) {
              $config = $this->getConfig();
              $credits = self::getCredits( ExtensionRegistry::getInstance(), $config );
      
              $this->setHeaders();
      Severity: Major
      Found in includes/specials/SpecialVersion.php - About 4 hrs to fix

        SpecialVersion has 35 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SpecialVersion extends SpecialPage {
        
            /**
             * @var string The current rev id/SHA hash of MediaWiki core
             */
        Severity: Minor
        Found in includes/specials/SpecialVersion.php - About 4 hrs to fix

          Method getExternalLibraries has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function getExternalLibraries( array $credits ) {
                  $paths = [
                      MW_INSTALL_PATH . '/vendor/composer/installed.json'
                  ];
          
          
          Severity: Major
          Found in includes/specials/SpecialVersion.php - About 3 hrs to fix

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

                protected function getExternalLibraries( array $credits ) {
                    $paths = [
                        MW_INSTALL_PATH . '/vendor/composer/installed.json'
                    ];
            
            
            Severity: Minor
            Found in includes/specials/SpecialVersion.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 getEntryPointInfo has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getEntryPointInfo() {
                    $config = $this->getConfig();
                    $scriptPath = $config->get( MainConfigNames::ScriptPath ) ?: '/';
            
                    $entryPoints = [
            Severity: Major
            Found in includes/specials/SpecialVersion.php - About 2 hrs to fix

              Function listAuthors has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function listAuthors( $authors, $extName, $extDir ): string {
                      $hasOthers = false;
                      $linkRenderer = $this->getLinkRenderer();
              
                      $list = [];
              Severity: Minor
              Found in includes/specials/SpecialVersion.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 listAuthors has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function listAuthors( $authors, $extName, $extDir ): string {
                      $hasOthers = false;
                      $linkRenderer = $this->getLinkRenderer();
              
                      $list = [];
              Severity: Minor
              Found in includes/specials/SpecialVersion.php - About 1 hr to fix

                Method getClientSideLibraries has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function getClientSideLibraries() {
                        $this->addTocSection( 'version-libraries-client', 'mw-version-libraries-client' );
                
                        $out = Html::element(
                            'h2',
                Severity: Minor
                Found in includes/specials/SpecialVersion.php - About 1 hr to fix

                  Method getExtensionCredits has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getExtensionCredits( array $credits ) {
                          $extensionTypes = self::getExtensionTypes();
                  
                          $this->addTocSection( 'version-extensions', 'mw-version-ext' );
                  
                  
                  Severity: Minor
                  Found in includes/specials/SpecialVersion.php - About 1 hr to fix

                    Method getHooks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getHooks() {
                            if ( !$this->getConfig()->get( MainConfigNames::SpecialVersionShowHooks ) ) {
                                return '';
                            }
                    
                    
                    Severity: Minor
                    Found in includes/specials/SpecialVersion.php - About 1 hr to fix

                      Method getParserTags has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function getParserTags() {
                              $tags = $this->parserFactory->getMainInstance()->getTags();
                              if ( !$tags ) {
                                  return '';
                              }
                      Severity: Minor
                      Found in includes/specials/SpecialVersion.php - About 1 hr to fix

                        Method getCopyrightAndAuthorList has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function getCopyrightAndAuthorList() {
                                if ( defined( 'MEDIAWIKI_INSTALL' ) ) {
                                    $othersLink = '[https://www.mediawiki.org/wiki/Special:Version/Credits ' .
                                        wfMessage( 'version-poweredby-others' )->plain() . ']';
                                } else {
                        Severity: Minor
                        Found in includes/specials/SpecialVersion.php - About 1 hr to fix

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

                              private function getExtensionCredits( array $credits ) {
                                  $extensionTypes = self::getExtensionTypes();
                          
                                  $this->addTocSection( 'version-extensions', 'mw-version-ext' );
                          
                          
                          Severity: Minor
                          Found in includes/specials/SpecialVersion.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 arrayToString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function arrayToString( $list ) {
                                  if ( is_array( $list ) && count( $list ) == 1 ) {
                                      $list = $list[0];
                                  }
                                  if ( $list instanceof Closure ) {
                          Severity: Minor
                          Found in includes/specials/SpecialVersion.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 parseForeignResources has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function parseForeignResources() {
                                  $registryDirs = [ 'MediaWiki' => MW_INSTALL_PATH . '/resources/lib' ]
                                      + ExtensionRegistry::getInstance()->getAttribute( 'ForeignResourcesDir' );
                          
                                  $modules = [];
                          Severity: Minor
                          Found in includes/specials/SpecialVersion.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

                          There are no issues that match your filters.

                          Category
                          Status