wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method getDescriptionSection has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getDescriptionSection() {
        $config = $this->getConfig();
        if ( $this->mSessionKey ) {
            $stash = $this->localRepo->getUploadStash( $this->getUser() );
            try {
Severity: Major
Found in includes/specials/forms/UploadForm.php - About 3 hrs to fix

    Method showUploadWarning has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function showUploadWarning( $warnings ) {
            # If there are no warnings, or warnings we can ignore, return early.
            # mDestWarningAck is set when some javascript has shown the warning
            # to the user. mForReUpload is set when the user clicks the "upload a
            # new version" link.
    Severity: Major
    Found in includes/specials/SpecialUpload.php - About 3 hrs to fix

      Method addUserToGroup has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addUserToGroup(
              UserIdentity $user,
              string $group,
              string $expiry = null,
              bool $allowUpdate = false
      Severity: Major
      Found in includes/user/UserGroupManager.php - About 3 hrs to fix

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

            public function execute() {
                $passwordFactory = $this->getServiceContainer()->getPasswordFactory();
        
                $typeInfo = $passwordFactory->getTypes();
                $layeredType = $this->getOption( 'type' );
        Severity: Major
        Found in maintenance/wrapOldPasswords.php - About 3 hrs to fix

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

                  function minutesToHours( min ) {
                      const tzHour = Math.floor( Math.abs( min ) / 60 ),
                          tzMin = Math.abs( min ) % 60,
                          tzString = ( ( min >= 0 ) ? '' : '-' ) + ( ( tzHour < 10 ) ? '0' : '' ) + tzHour +
                              ':' + ( ( tzMin < 10 ) ? '0' : '' ) + tzMin;
          Severity: Major
          Found in resources/src/mediawiki.special.preferences.ooui/timezone.js and 1 other location - About 3 hrs to fix
          resources/src/mediawiki.htmlform/timezone.js on lines 5..11

          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 106.

          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 minutesToHours( min ) {
              const tzHour = Math.floor( Math.abs( min ) / 60 ),
                  tzMin = Math.abs( min ) % 60,
                  tzString = ( ( min >= 0 ) ? '' : '-' ) + ( ( tzHour < 10 ) ? '0' : '' ) + tzHour +
                      ':' + ( ( tzMin < 10 ) ? '0' : '' ) + tzMin;
          Severity: Major
          Found in resources/src/mediawiki.htmlform/timezone.js and 1 other location - About 3 hrs to fix
          resources/src/mediawiki.special.preferences.ooui/timezone.js on lines 22..28

          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 106.

          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

          File ChronologyProtector.php has 314 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/libs/rdbms/ChronologyProtector.php - About 3 hrs to fix

            File BackupDumper.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Base classes for database-dumping maintenance scripts.
             *
             * Copyright © 2005 Brooke Vibber <bvibber@wikimedia.org>
            Severity: Minor
            Found in maintenance/includes/BackupDumper.php - About 3 hrs to fix

              Function init has 88 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function init() {
                  const conditionalViews = {},
                      $initialFieldset = $( 'fieldset.cloptions' ),
                      savedQueriesPreferenceName = mw.config.get( 'wgStructuredChangeFiltersSavedQueriesPreferenceName' ),
                      daysPreferenceName = mw.config.get( 'wgStructuredChangeFiltersDaysPreferenceName' ),
              Severity: Major
              Found in resources/src/mediawiki.rcfilters/mw.rcfilters.js - About 3 hrs to fix

                Method normalizeHandler has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function normalizeHandler( string $hook, $handler, array $options = [] ) {
                        if ( is_object( $handler ) && !$handler instanceof Closure ) {
                            $handler = [ $handler, $this->getHookMethodName( $hook ) ];
                        }
                
                
                Severity: Major
                Found in includes/HookContainer/HookContainer.php - About 3 hrs to fix

                  Method formatTimePeriod has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function formatTimePeriod( $seconds, $format = [] ) {
                          if ( !is_array( $format ) ) {
                              $format = [ 'avoid' => $format ]; // For backwards compatibility
                          }
                          if ( !isset( $format['avoid'] ) ) {
                  Severity: Major
                  Found in includes/language/Language.php - About 3 hrs to fix

                    Method formatDiffRow2 has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function formatDiffRow2(
                            $title, $oldid, $newid, $timestamp, $formattedComment, $actiontext = ''
                        ) {
                            $feedDiffCutoff = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::FeedDiffCutoff );
                    
                    
                    Severity: Major
                    Found in includes/Feed/FeedUtils.php - About 3 hrs to fix

                      Method extractRowInfo has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function extractRowInfo( $row ) {
                              $logEntry = DatabaseLogEntry::newFromRow( $row );
                              $vals = [
                                  ApiResult::META_TYPE => 'assoc',
                              ];
                      Severity: Major
                      Found in includes/api/ApiQueryLogEvents.php - About 3 hrs to fix

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

                            public function execute() {
                                $pages = $this->getPageSet()->getGoodPages();
                                if ( $pages === [] ) {
                                    return;
                                }
                        Severity: Major
                        Found in includes/api/ApiQueryIWLinks.php - About 3 hrs to fix

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

                              public function execute() {
                                  $repo = $this->getServiceContainer()->getRepoGroup()->getLocalRepo();
                                  $tempRepo = $repo->getTempRepo();
                          
                                  $dbr = $repo->getReplicaDB();
                          Severity: Major
                          Found in maintenance/cleanupUploadStash.php - About 3 hrs to fix

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

                                public function execute() {
                                    // Extensions will do stuff like $wgResourceModules += array(...) which is a
                                    // fatal unless an array is already set. So set an empty value.
                                    // And use the weird $__settings name to avoid any conflicts
                                    // with real poorly named settings.
                            Severity: Major
                            Found in maintenance/convertExtensionToRegistration.php - About 3 hrs to fix

                              File IcuCollation.php has 313 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/collation/IcuCollation.php - About 3 hrs to fix

                                File MessagesRu.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /** Russian (русский)
                                 *
                                 * @file
                                 * @ingroup Languages
                                Severity: Minor
                                Found in languages/messages/MessagesRu.php - About 3 hrs to fix

                                  File MessagesNl.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  /** Dutch (Nederlands)
                                   *
                                   * @file
                                   * @ingroup Languages
                                  Severity: Minor
                                  Found in languages/messages/MessagesNl.php - About 3 hrs to fix

                                    util has 29 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    const util = {
                                    
                                        /**
                                         * Encode the string like PHP's rawurlencode.
                                         *
                                    Severity: Minor
                                    Found in resources/src/mediawiki.util/util.js - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language