wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public static function cleanUrl( string $url ): string {
        # Normalize any HTML entities in input. They will be
        # re-escaped by makeExternalLink().
        $url = self::decodeCharReferences( $url );

Severity: Major
Found in includes/parser/Sanitizer.php - About 2 hrs to fix

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

        public static function login( $username, $password, WebRequest $request ) {
            $enableBotPasswords = MediaWikiServices::getInstance()->getMainConfig()
                ->get( MainConfigNames::EnableBotPasswords );
            $passwordAttemptThrottle = MediaWikiServices::getInstance()->getMainConfig()
                ->get( MainConfigNames::PasswordAttemptThrottle );
    Severity: Major
    Found in includes/user/BotPassword.php - About 2 hrs to fix

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

          public static function newSystemUser( $name, $options = [] ) {
              $options += [
                  'validate' => UserRigorOptions::RIGOR_VALID,
                  'create' => true,
                  'steal' => false,
      Severity: Major
      Found in includes/user/User.php - About 2 hrs to fix

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

            public function generateAndSaveThumb( $tmpFile, $transformParams, $flags ) {
                $ignoreImageErrors = MediaWikiServices::getInstance()->getMainConfig()
                    ->get( MainConfigNames::IgnoreImageErrors );
        
                if ( !$this->repo->canTransformLocally() ) {
        Severity: Major
        Found in includes/filerepo/file/File.php - About 2 hrs to fix

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

              public function doUpdate() {
                  $services = MediaWikiServices::getInstance();
                  $metric = $services->getStatsFactory()->getCounter( 'site_stats_total' );
                  $shards = $services->getMainConfig()->get( MainConfigNames::MultiShardSiteStats ) ?
                      self::SHARDS_ON : self::SHARDS_OFF;
          Severity: Major
          Found in includes/deferred/SiteStatsUpdate.php - About 2 hrs to fix

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

                private static function indexifyHost( $host, $reverse = true ) {
                    // Canonicalize.
                    $host = rawurldecode( $host );
                    if ( $host !== '' ) {
                        $tmp = idn_to_utf8( $host );
            Severity: Major
            Found in includes/ExternalLinks/LinkFilter.php - About 2 hrs to fix

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

                  private static function HTCPPurge( array $urls ) {
                      $htcpRouting = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::HTCPRouting );
                      $htcpMulticastTTL = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::HTCPMulticastTTL );
                      // HTCP CLR operation
                      $htcpOpCLR = 4;
              Severity: Major
              Found in includes/deferred/CdnCacheUpdate.php - About 2 hrs to fix

                File MessagesZh_hant.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /** Traditional Chinese (中文(繁體))
                 *
                 * @file
                 * @ingroup Languages
                Severity: Minor
                Found in languages/messages/MessagesZh_hant.php - About 2 hrs to fix

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

                      public function execute() {
                          $offset = $this->getArg( 0 ) * 3600;
                          $start = $this->getArg( 1 );
                          $end = $this->getArg( 2 );
                          // maximum normal clock offset
                  Severity: Major
                  Found in maintenance/fixTimestamps.php - About 2 hrs to fix

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

                        private function processTable( IDatabase $db, $op, $table, $nsField, $titleField, $pkFields ) {
                            if ( $this->tables !== null && !in_array( $table, $this->tables, true ) ) {
                                $this->output( "Skipping table `$table`, not in --tables.\n" );
                                return;
                            }
                    Severity: Major
                    Found in maintenance/uppercaseTitlesForUnicodeTransition.php - About 2 hrs to fix

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

                          public function execute() {
                              $this->initServices();
                      
                              $oldName = $this->getArg( 'old-name' );
                              $newName = $this->getArg( 'new-name' );
                      Severity: Major
                      Found in maintenance/renameUser.php - About 2 hrs to fix

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

                            public function execute() {
                                $batchSize = $this->getBatchSize();
                                $dbw = $this->getPrimaryDB();
                                $dbr = $this->getReplicaDB();
                                $from = wfTimestampOrNull( TS_MW, $this->getOption( 'from' ) );
                        Severity: Major
                        Found in maintenance/resetPageRandom.php - About 2 hrs to fix

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

                              public function execute() {
                                  if ( $this->hasOption( 'showgrants' ) ) {
                                      $this->showGrants();
                                      return;
                                  }
                          Severity: Major
                          Found in maintenance/createBotPassword.php - About 2 hrs to fix

                            File MessagesSv.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /** Swedish (svenska)
                             *
                             * @file
                             * @ingroup Languages
                            Severity: Minor
                            Found in languages/messages/MessagesSv.php - About 2 hrs to fix

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      pluralForm = function (n) {
                                          return n === 0
                                              ? 0
                                              : n === 1
                                              ? 1
                              Severity: Major
                              Found in resources/lib/moment/locale/ar-ly.js and 1 other location - About 2 hrs to fix
                              resources/lib/moment/locale/ar.js on lines 40..52

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 84.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                              function removeEvent(node, event, fn, opt_useCapture) {
                                if (typeof node.removeEventListener == 'function') {
                                  node.removeEventListener(event, fn, opt_useCapture || false);
                                }
                                else if (typeof node.detatchEvent == 'function') {
                              Severity: Major
                              Found in resources/lib/intersection-observer/intersection-observer.js and 1 other location - About 2 hrs to fix
                              resources/lib/intersection-observer/intersection-observer.js on lines 802..809

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 84.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      if ( this.shortDayNames && !this.dayLetters ) {
                                          this.dayLetters = [];
                                          // eslint-disable-next-line no-jquery/no-each-util
                                          $.each( this.shortDayNames, ( k, v ) => {
                                              this.dayLetters[ k ] = v.slice( 0, 1 );
                              resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 187..193

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 84.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                              function addEvent(node, event, fn, opt_useCapture) {
                                if (typeof node.addEventListener == 'function') {
                                  node.addEventListener(event, fn, opt_useCapture || false);
                                }
                                else if (typeof node.attachEvent == 'function') {
                              Severity: Major
                              Found in resources/lib/intersection-observer/intersection-observer.js and 1 other location - About 2 hrs to fix
                              resources/lib/intersection-observer/intersection-observer.js on lines 820..827

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 84.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      pluralForm = function (n) {
                                          return n === 0
                                              ? 0
                                              : n === 1
                                              ? 1
                              Severity: Major
                              Found in resources/lib/moment/locale/ar.js and 1 other location - About 2 hrs to fix
                              resources/lib/moment/locale/ar-ly.js on lines 26..38

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 84.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      if ( this.fullDayNames && !this.dayLetters ) {
                                          this.dayLetters = [];
                                          // eslint-disable-next-line no-jquery/no-each-util
                                          $.each( this.fullDayNames, ( k, v ) => {
                                              this.dayLetters[ k ] = v.slice( 0, 1 );
                              resources/src/mediawiki.widgets.datetime/ProlepticGregorianDateTimeFormatter.js on lines 180..186

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 84.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Severity
                              Category
                              Status
                              Source
                              Language