wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method newRevisionFromRowAndSlots has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function newRevisionFromRowAndSlots(
        stdClass $row,
        $slots,
        int $queryFlags = 0,
        ?PageIdentity $page = null,
Severity: Major
Found in includes/Revision/RevisionStore.php - About 3 hrs to fix

    Method rcPreferences has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function rcPreferences( User $user, MessageLocalizer $l10n, &$defaultPreferences ) {
            $rcMaxAge = $this->options->get( MainConfigNames::RCMaxAge );
            $rcMax = ceil( $rcMaxAge / ( 3600 * 24 ) );
            $defaultPreferences['rcdays'] = [
                'type' => 'float',
    Severity: Major
    Found in includes/preferences/DefaultPreferencesFactory.php - About 3 hrs to fix

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

          public function execute() {
              $authority = $this->getAuthority();
      
              // Fail early if the user is sitewide blocked.
              $block = $authority->getBlock();
      Severity: Major
      Found in includes/api/ApiPurge.php - About 3 hrs to fix

        Method generateThumbnail has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function generateThumbnail( File $file, array $params, $thumbName, $thumbPath ) {
                $attemptFailureEpoch = $this->getConfig( MainConfigNames::AttemptFailureEpoch );
        
                $services = MediaWikiServices::getInstance()->getObjectCacheFactory();
        
        
        Severity: Major
        Found in includes/filerepo/ThumbnailEntryPoint.php - About 3 hrs to fix

          File DateTimeFormatter.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          ( function () {
          
              /**
               * @class
               * @classdesc Provides various methods needed for formatting dates and times.
          Severity: Minor
          Found in resources/src/mediawiki.widgets.datetime/DateTimeFormatter.js - About 3 hrs to fix

            File LocalSettingsGenerator.php has 311 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/installer/LocalSettingsGenerator.php - About 3 hrs to fix

              File MessagesVi.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /** Vietnamese (Tiếng Việt)
               *
               * @file
               * @ingroup Languages
              Severity: Minor
              Found in languages/messages/MessagesVi.php - About 3 hrs to fix

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

                    function nOrMore(n, p) {
                        return function() {
                            var originalPos = pos,
                                result = [],
                                parsed = p();
                Severity: Major
                Found in resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js and 1 other location - About 3 hrs to fix
                resources/lib/jquery.i18n/src/jquery.i18n.parser.js on lines 97..116

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

                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

                        if ( config.formatter instanceof mw.widgets.datetime.DateTimeFormatter ) {
                            this.formatter = config.formatter;
                        } else if ( $.isPlainObject( config.formatter ) ) {
                            this.formatter = new mw.widgets.datetime.ProlepticGregorianDateTimeFormatter( config.formatter );
                        } else {
                Severity: Major
                Found in resources/src/mediawiki.widgets.datetime/CalendarWidget.js and 1 other location - About 3 hrs to fix
                resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js on lines 120..126

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

                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

                        if ( config.formatter instanceof mw.widgets.datetime.DateTimeFormatter ) {
                            this.formatter = config.formatter;
                        } else if ( $.isPlainObject( config.formatter ) ) {
                            this.formatter = new mw.widgets.datetime.ProlepticGregorianDateTimeFormatter( config.formatter );
                        } else {
                resources/src/mediawiki.widgets.datetime/CalendarWidget.js on lines 67..73

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

                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 nOrMore( n, p ) {
                                return function () {
                                    var originalPos = pos,
                                        result = [],
                                        parsed = p();
                Severity: Major
                Found in resources/lib/jquery.i18n/src/jquery.i18n.parser.js and 1 other location - About 3 hrs to fix
                resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js on lines 149..168

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

                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

                    public function handleAdds( IReadableDatabase $dbr, $output ) {
                        fwrite( $output, "# Additions\n" );
                
                        foreach ( $this->getNewCatsIterator( $dbr, __METHOD__ ) as $batch ) {
                            $pages = [];
                Severity: Major
                Found in maintenance/categoryChangesAsRdf.php and 1 other location - About 3 hrs to fix
                maintenance/categoryChangesAsRdf.php on lines 505..529

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

                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

                    public function handleRestores( IReadableDatabase $dbr, $output ) {
                        fwrite( $output, "# Restores\n" );
                
                        // This will only find those restores that were not deleted later.
                        foreach ( $this->getRestoredCatsIterator( $dbr, __METHOD__ ) as $batch ) {
                Severity: Major
                Found in maintenance/categoryChangesAsRdf.php and 1 other location - About 3 hrs to fix
                maintenance/categoryChangesAsRdf.php on lines 535..557

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

                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

                Function diffCleanupMerge has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    DiffMatchPatch.prototype.diffCleanupMerge = function (diffs) {
                      diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
                      var pointer = 0;
                      var countDelete = 0;
                      var countInsert = 0;
                Severity: Major
                Found in resources/lib/qunitjs/qunit.js - About 3 hrs to fix

                  Method beginAccountLink has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function beginAccountLink( User $user, array $reqs, $returnToUrl ) {
                          $session = $this->request->getSession();
                          $session->remove( self::ACCOUNT_LINK_STATE );
                  
                          if ( !$this->canLinkAccounts() ) {
                  Severity: Major
                  Found in includes/auth/AuthManager.php - About 3 hrs to fix

                    Method tempDelete has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function tempDelete() {
                            $article = $this->getArticle();
                            $title = $this->getTitle();
                            $context = $this->getContext();
                            $user = $context->getUser();
                    Severity: Major
                    Found in includes/actions/DeleteAction.php - About 3 hrs to fix

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

                          public function getAllowedParams() {
                              return [
                                  'limit' => [
                                      ParamValidator::PARAM_DEFAULT => 10,
                                      ParamValidator::PARAM_TYPE => 'limit',
                      Severity: Major
                      Found in includes/api/ApiQueryUserContribs.php - About 3 hrs to fix

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

                            private function run( $resultPageSet = null ) {
                                $db = $this->getDB();
                                $params = $this->extractRequestParams();
                        
                                $this->addTables( 'category' );
                        Severity: Major
                        Found in includes/api/ApiQueryAllCategories.php - About 3 hrs to fix

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

                              public function getAllowedParams() {
                                  $smallLimit = $this->getMain()->canApiHighLimits() ? ApiBase::LIMIT_SML2 : ApiBase::LIMIT_SML1;
                                  return [
                                      'start' => [
                                          ParamValidator::PARAM_TYPE => 'timestamp',
                          Severity: Major
                          Found in includes/api/ApiQueryDeletedrevs.php - About 3 hrs to fix

                            Method maybeAlterFormDefaults has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function maybeAlterFormDefaults( &$fields ) {
                                    // This will be overwritten by request data
                                    $fields['Target']['default'] = (string)$this->target;
                            
                                    if ( $this->target ) {
                            Severity: Major
                            Found in includes/specials/SpecialBlock.php - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language