wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

FileBackendMultiWrite has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class FileBackendMultiWrite extends FileBackend {
    /** @var FileBackendStore[] Prioritized list of FileBackendStore objects */
    protected $backends = [];

    /** @var int Index of master backend */
Severity: Minor
Found in includes/libs/filebackend/FileBackendMultiWrite.php - About 5 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
                    || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
                    || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
                    || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
                    || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
    Severity: Critical
    Found in includes/api/ApiQueryRecentChanges.php - About 5 hrs to fix

      ApiResult has 40 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ApiResult implements ApiSerializable {
      
          /**
           * Override existing value in addValue(), setValue(), and similar functions
           * @since 1.21
      Severity: Minor
      Found in includes/api/ApiResult.php - About 5 hrs to fix

        Method getModuleInfo has 133 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getModuleInfo( $module ) {
                $ret = [];
                $path = $module->getModulePath();
                $paramValidator = $module->getMain()->getParamValidator();
        
        
        Severity: Major
        Found in includes/api/ApiParamInfo.php - About 5 hrs to fix

          File EmailNotification.php has 388 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/mail/EmailNotification.php - About 5 hrs to fix

            File RestrictionStore.php has 387 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace MediaWiki\Permissions;
            
            use MediaWiki\Cache\CacheKeyHelper;
            Severity: Minor
            Found in includes/Permissions/RestrictionStore.php - About 5 hrs to fix

              Method formatRow has 132 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function formatRow( $row ) {
                      $resultOffset = $this->getResultOffset();
                      $numRows = min( $this->mResult->numRows(), $this->mLimit );
              
                      $firstInList = $resultOffset === ( $this->mIsBackwards ? $numRows - 1 : 0 );
              Severity: Major
              Found in includes/actions/pagers/HistoryPager.php - About 5 hrs to fix

                Method run has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function run( $resultPageSet = null ) {
                        $this->params = $this->extractRequestParams( false );
                        $this->redirect = isset( $this->params['redirect'] ) && $this->params['redirect'];
                        $userMax = ( $this->redirect ? ApiBase::LIMIT_BIG1 / 2 : ApiBase::LIMIT_BIG1 );
                        $botMax = ( $this->redirect ? ApiBase::LIMIT_BIG2 / 2 : ApiBase::LIMIT_BIG2 );
                Severity: Major
                Found in includes/api/ApiQueryBacklinks.php - About 5 hrs to fix

                  Method formatValue has 132 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function formatValue( $name, $value ) {
                          static $msg = null;
                          if ( $msg === null ) {
                              $keys = [
                                  'anononlyblock',
                  Severity: Major
                  Found in includes/specials/pagers/BlockListPager.php - About 5 hrs to fix

                    File ZipDirectoryReader.php has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * ZIP file directories reader, for the purposes of upload verification.
                     *
                     * This program is free software; you can redistribute it and/or modify
                    Severity: Minor
                    Found in includes/utils/ZipDirectoryReader.php - About 5 hrs to fix

                      Function extractNamespaces has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function extractNamespaces( array $info ) {
                              if ( isset( $info['namespaces'] ) ) {
                                  foreach ( $info['namespaces'] as $ns ) {
                                      if ( defined( $ns['constant'] ) ) {
                                          // If the namespace constant is already defined, use it.
                      Severity: Minor
                      Found in includes/registration/ExtensionProcessor.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 showHeader has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function showHeader(): void {
                              $out = $this->context->getOutput();
                              $user = $this->context->getUser();
                              if ( $this->isConflict ) {
                                  $this->addExplainConflictHeader();
                      Severity: Minor
                      Found in includes/editpage/EditPage.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 getLocksOnServer has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function getLocksOnServer( $lockSrv, array $pathsByType ) {
                              $status = StatusValue::newGood();
                      
                              $memc = $this->getCache( $lockSrv );
                              // List of affected paths
                      Severity: Minor
                      Found in includes/libs/lockmanager/MemcLockManager.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 getCompleteMetrics has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getCompleteMetrics() {
                              if ( $this->complete === null ) {
                                  // Start with inclusive data
                                  $this->complete = $this->getInclusiveMetrics();
                      
                      
                      Severity: Minor
                      Found in includes/libs/XhprofData.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 buildNavUrls has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function buildNavUrls() {
                              $out = $this->getOutput();
                              $title = $this->getTitle();
                              $thispage = $title->getPrefixedDBkey();
                              $uploadNavigationUrl = $this->getConfig()->get( MainConfigNames::UploadNavigationUrl );
                      Severity: Minor
                      Found in includes/skins/Skin.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 getResetKinds has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getResetKinds(
                              User $user, IContextSource $context, $options = null
                          ): array {
                              $options ??= $this->userOptionsManager->loadUserOptions( $user );
                      
                      
                      Severity: Minor
                      Found in includes/preferences/DefaultPreferencesFactory.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 retrieveMetaData has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function retrieveMetaData() {
                              $config = MediaWikiServices::getInstance()->getMainConfig();
                              $djvuDump = $config->get( MainConfigNames::DjvuDump );
                              $djvuTxt = $config->get( MainConfigNames::DjvuTxt );
                              $djvuUseBoxedCommand = $config->get( MainConfigNames::DjvuUseBoxedCommand );
                      Severity: Minor
                      Found in includes/media/DjVuImage.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 run has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function run( array $options ) {
                              $type = $options['type'] ?? false;
                              $maxJobs = $options['maxJobs'] ?? false;
                              $maxTime = $options['maxTime'] ?? false;
                              $throttle = $options['throttle'] ?? true;
                      Severity: Minor
                      Found in includes/jobqueue/JobRunner.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 getMessageParameters has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function getMessageParameters() {
                              $params = parent::getMessageParameters();
                      
                              $title = $this->entry->getTarget();
                              if ( substr( $title->getText(), 0, 1 ) === '#' ) {
                      Severity: Minor
                      Found in includes/logging/BlockLogFormatter.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 showLogExtract has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function showLogExtract(
                              &$out, $types = [], $page = '', $user = '', $param = []
                          ) {
                              $defaultParameters = [
                                  'lim' => 25,
                      Severity: Minor
                      Found in includes/logging/LogEventsList.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

                      Severity
                      Category
                      Status
                      Source
                      Language