wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method preloadTitleInfo has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function preloadTitleInfo(
        Context $context, array $moduleNames
    ) {
        $rl = $context->getResourceLoader();
        // getDB() can be overridden to point to a foreign database.
Severity: Major
Found in includes/ResourceLoader/WikiModule.php - About 2 hrs to fix

    Method initTimestampLimits has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function initTimestampLimits() {
            // Max timestamp should be min of destination page
            $firstDestTimestamp = $this->dbw->newSelectQueryBuilder()
                ->select( 'MIN(rev_timestamp)' )
                ->from( 'revision' )
    Severity: Major
    Found in includes/page/MergeHistory.php - About 2 hrs to fix

      Method initAndPopPoolSlotList has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function initAndPopPoolSlotList( RedisConnRef $conn, $now ) {
              static $script = /** @lang Lua */ <<<LUA
              local kSlots,kSlotsNextRelease,kSlotWaits = unpack(KEYS)
              local rMaxWorkers,rMaxQueue,rTimeout,rExpiry,rSess,rTime = unpack(ARGV)
              -- Initialize if the "next release" time sorted-set is empty. The slot key
      Severity: Major
      Found in includes/poolcounter/PoolCounterRedis.php - About 2 hrs to fix

        Method findMostProgress has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function findMostProgress( $M, $N, $limit, $V ) {
                $delta = $N - $M;
        
                if ( ( $M & 1 ) == ( $limit & 1 ) ) {
                    $forward_start_diag = max( -$M, -$limit );
        Severity: Major
        Found in includes/libs/Diff/DiffEngine.php - About 2 hrs to fix

          Method skinPreferences has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function skinPreferences( User $user, IContextSource $context, &$defaultPreferences ) {
                  // Skin selector, if there is at least one valid skin
                  $validSkinNames = $this->getValidSkinNames( $user, $context );
                  if ( $validSkinNames ) {
                      $defaultPreferences['skin'] = [
          Severity: Major
          Found in includes/preferences/DefaultPreferencesFactory.php - About 2 hrs to fix

            Method saveSites has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function saveSites( array $sites ) {
                    if ( !$sites ) {
                        return true;
                    }
            
            
            Severity: Major
            Found in includes/site/DBSiteStore.php - About 2 hrs to fix

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

                  public function execute() {
                      $this->useTransactionalTimeLimit();
              
                      $params = $this->extractRequestParams();
              
              
              Severity: Major
              Found in includes/api/ApiUndelete.php - About 2 hrs to fix

                Method getAllowedParams has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getAllowedParams() {
                        $params = [
                            'user' => [
                                ParamValidator::PARAM_TYPE => 'user',
                                UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name', 'ip', 'temp', 'cidr', 'id' ],
                Severity: Major
                Found in includes/api/ApiBlock.php - About 2 hrs to fix

                  Method formatResult has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function formatResult( $skin, $result ) {
                          // If no Title B or C is in the query, it means this came from
                          // querycache (which only saves the 3 columns for title A).
                          // That does save the bulk of the query cost, but now we need to
                          // get a little more detail about each individual entry quickly
                  Severity: Major
                  Found in includes/specials/SpecialDoubleRedirects.php - About 2 hrs to fix

                    Method deleteServerObjectsExpiringBefore has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function deleteServerObjectsExpiringBefore(
                            IDatabase $db,
                            $timestamp,
                            $limit,
                            &$keysDeletedCount = 0,
                    Severity: Major
                    Found in includes/objectcache/SqlBagOStuff.php - About 2 hrs to fix

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

                          public function execute( $par ) {
                              $this->setHeaders();
                              $this->outputHeader();
                              $out = $this->getOutput();
                              $out->disallowUserJs(); # Prevent hijacked user scripts from sniffing passwords etc.
                      Severity: Major
                      Found in includes/specials/SpecialPreferences.php - About 2 hrs to fix

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

                            public function execute( $par ) {
                                $this->useTransactionalTimeLimit();
                        
                                $this->setHeaders();
                                $this->outputHeader();
                        Severity: Major
                        Found in includes/specials/SpecialUpload.php - About 2 hrs to fix

                          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

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

                                public function execute( $par ) {
                                    $context = new DerivativeContext( $this->getContext() );
                            
                                    $this->setHeaders();
                                    $this->outputHeader();
                            Severity: Major
                            Found in includes/specials/SpecialNewFiles.php - About 2 hrs to fix

                              Method displaytitle has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function displaytitle( $parser, $text = '', $uarg = '' ) {
                                      $restrictDisplayTitle = MediaWikiServices::getInstance()->getMainConfig()
                                          ->get( MainConfigNames::RestrictDisplayTitle );
                              
                                      static $magicWords = null;
                              Severity: Major
                              Found in includes/parser/CoreParserFunctions.php - About 2 hrs to fix

                                Method handleExternalLinks has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function handleExternalLinks( $text ) {
                                        $bits = preg_split( $this->mExtLinkBracketedRegex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
                                        // @phan-suppress-next-line PhanTypeComparisonFromArray See phan issue #3161
                                        if ( $bits === false ) {
                                            throw new RuntimeException( "PCRE failure" );
                                Severity: Major
                                Found in includes/parser/Parser.php - About 2 hrs to fix

                                  Method findFile has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function findFile( $title, $options = [] ) {
                                          if ( !empty( $options['private'] ) && !( $options['private'] instanceof Authority ) ) {
                                              throw new InvalidArgumentException(
                                                  __METHOD__ . ' called with the `private` option set to something ' .
                                                  'other than an Authority object'
                                  Severity: Major
                                  Found in includes/filerepo/FileRepo.php - About 2 hrs to fix

                                    Method deleteOptions has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private function deleteOptions() {
                                            $dryRun = $this->hasOption( 'dry' );
                                            $option = $this->getArg( 0 );
                                            $fromUserId = (int)$this->getOption( 'fromuserid', 0 );
                                            $toUserId = (int)$this->getOption( 'touserid', 0 ) ?: null;
                                    Severity: Major
                                    Found in maintenance/userOptions.php - About 2 hrs to fix

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

                                          public function execute() {
                                              $ns = $this->getOption( 'ns', NS_MEDIAWIKI );
                                              $delete = $this->hasOption( 'delete' );
                                              $all = $this->hasOption( 'all' );
                                              $dbw = $this->getPrimaryDB();
                                      Severity: Major
                                      Found in maintenance/nukeNS.php - About 2 hrs to fix

                                        File WikiRevision.php has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                                        Open

                                        <?php
                                        /**
                                         * MediaWiki page data importer.
                                         *
                                         * Copyright © 2003,2005 Brooke Vibber <bvibber@wikimedia.org>
                                        Severity: Minor
                                        Found in includes/import/WikiRevision.php - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language