wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method selectSQLText has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function selectSQLText(
        $tables, $vars, $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
    ) {
        if ( !is_array( $tables ) ) {
            if ( $tables === '' || $tables === null || $tables === false ) {
Severity: Major
Found in includes/libs/rdbms/platform/SQLPlatform.php - About 4 hrs to fix

    Method makeCSPDirectives has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function makeCSPDirectives( $policyConfig, $mode ) {
            if ( $policyConfig === false ) {
                // CSP is disabled
                return '';
            }
    Severity: Major
    Found in includes/Request/ContentSecurityPolicy.php - About 4 hrs to fix

      Method recXmlPrint has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function recXmlPrint( $name, $value, $indent, $attributes = [] ) {
              $retval = '';
              if ( $indent !== null ) {
                  if ( $name !== null ) {
                      $indent += 2;
      Severity: Major
      Found in includes/api/ApiFormatXml.php - About 4 hrs to fix

        Method output has 110 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function output( $return = false ) {
                if ( $this->mDoNothing ) {
                    return $return ? '' : null;
                }
        
        
        Severity: Major
        Found in includes/Output/OutputPage.php - About 4 hrs to fix

          Method doVariants has 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function doVariants( &$classes ) {
                  $linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
                  $linkBatch = $linkBatchFactory->newLinkBatch();
                  $variantMap = []; // maps $pdbkey_Variant => $keys (of link holders)
                  $output = $this->parent->getOutput();
          Severity: Major
          Found in includes/parser/LinkHolderArray.php - About 4 hrs to fix

            Method save has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function save( $send = self::SEND_FEED ) {
                    $services = MediaWikiServices::getInstance();
                    $mainConfig = $services->getMainConfig();
                    $putIPinRC = $mainConfig->get( MainConfigNames::PutIPinRC );
                    $dbw = $services->getConnectionProvider()->getPrimaryDatabase();
            Severity: Major
            Found in includes/recentchanges/RecentChange.php - About 4 hrs to fix

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

                  public function execute() {
                      $services = $this->getServiceContainer();
                      $userFactory = $services->getUserFactory();
                      $userGroupManager = $services->getUserGroupManager();
                      $this->output( "Remove unused accounts\n\n" );
              Severity: Major
              Found in maintenance/removeUnusedAccounts.php - About 4 hrs to fix

                File ApiQuerySearch.php has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
                 *
                 * This program is free software; you can redistribute it and/or modify
                Severity: Minor
                Found in includes/api/ApiQuerySearch.php - About 4 hrs to fix

                  File SpecialBotPasswords.php has 348 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/specials/SpecialBotPasswords.php - About 4 hrs to fix

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

                        function to(time, withoutSuffix) {
                            if (
                                this.isValid() &&
                                ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
                            ) {
                    Severity: Major
                    Found in resources/lib/moment/moment.js and 1 other location - About 4 hrs to fix
                    resources/lib/moment/moment.js on lines 3979..3990

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

                    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

                    OO.ui.mixin.FloatableElement.prototype.setVerticalPosition = function ( position ) {
                        if ( [ 'below', 'above', 'top', 'bottom', 'center' ].indexOf( position ) === -1 ) {
                            throw new Error( 'Invalid value for vertical position: ' + position );
                        }
                        if ( this.verticalPosition !== position ) {
                    Severity: Major
                    Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 4 hrs to fix
                    resources/lib/ooui/oojs-ui-core.js on lines 5117..5127

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

                    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 from(time, withoutSuffix) {
                            if (
                                this.isValid() &&
                                ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
                            ) {
                    Severity: Major
                    Found in resources/lib/moment/moment.js and 1 other location - About 4 hrs to fix
                    resources/lib/moment/moment.js on lines 3996..4007

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

                    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

                    OO.ui.mixin.FloatableElement.prototype.setHorizontalPosition = function ( position ) {
                        if ( [ 'before', 'after', 'start', 'end', 'center' ].indexOf( position ) === -1 ) {
                            throw new Error( 'Invalid value for horizontal position: ' + position );
                        }
                        if ( this.horizontalPosition !== position ) {
                    Severity: Major
                    Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 4 hrs to fix
                    resources/lib/ooui/oojs-ui-core.js on lines 5100..5110

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

                    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

                    NamespaceInfo has 34 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class NamespaceInfo {
                    
                        /**
                         * These namespaces should always be first-letter capitalized, now and
                         * forevermore. Historically, they could've probably been lowercased too,
                    Severity: Minor
                    Found in includes/title/NamespaceInfo.php - About 4 hrs to fix

                      JobQueueDB has 34 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class JobQueueDB extends JobQueue {
                          /* seconds to cache info without re-validating */
                          private const CACHE_TTL_SHORT = 30;
                          /* seconds a job can live once claimed */
                          private const MAX_AGE_PRUNE = 7 * 24 * 3600;
                      Severity: Minor
                      Found in includes/jobqueue/JobQueueDB.php - About 4 hrs to fix

                        ArchivedFile has 34 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ArchivedFile {
                        
                            // Audience options for ::getDescription() and ::getUploader()
                            public const FOR_PUBLIC = 1;
                            public const FOR_THIS_USER = 2;
                        Severity: Minor
                        Found in includes/filerepo/file/ArchivedFile.php - About 4 hrs to fix

                          MaintenanceParameters has 34 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class MaintenanceParameters {
                          
                              /**
                               * Array of desired/allowed params
                               * @var array<string,array>
                          Severity: Minor
                          Found in maintenance/includes/MaintenanceParameters.php - About 4 hrs to fix

                            Method moveUnsafe has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function moveUnsafe( UserIdentity $user, $reason, $createRedirect, array $changeTags ) {
                                    $status = Status::newGood();
                            
                                    // TODO: make hooks accept UserIdentity
                                    $userObj = $this->userFactory->newFromUserIdentity( $user );
                            Severity: Major
                            Found in includes/page/MovePage.php - About 4 hrs to fix

                              Method showPatrolFooter has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function showPatrolFooter() {
                                      $context = $this->getContext();
                                      $mainConfig = $context->getConfig();
                                      $useNPPatrol = $mainConfig->get( MainConfigNames::UseNPPatrol );
                                      $useRCPatrol = $mainConfig->get( MainConfigNames::UseRCPatrol );
                              Severity: Major
                              Found in includes/page/Article.php - About 4 hrs to fix

                                Method dumpPages has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function dumpPages( $cond, $orderRevs ) {
                                        $revQuery = $this->revisionStore->getQueryInfo( [ 'page' ] );
                                        $slotQuery = $this->revisionStore->getSlotsQueryInfo( [ 'content' ] );
                                
                                        // We want page primary rather than revision.
                                Severity: Major
                                Found in includes/export/WikiExporter.php - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language