wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function execute() {
        $user = $this->getUser();

        if ( !$user->isRegistered() ) {
            $this->dieWithError( 'apierror-mustbeloggedin-uploadstash', 'stashnotloggedin' );
Severity: Major
Found in includes/api/ApiQueryMyStashedFiles.php - About 2 hrs to fix

    Method validate has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function validate( $key, &$value ) {
            switch ( $this->getPrefsKinds()[$key] ) {
                case 'registered':
                    // Regular option.
                    if ( $value === null ) {
    Severity: Major
    Found in includes/api/ApiOptionsBase.php - About 2 hrs to fix

      Method getHelp has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getHelp( IContextSource $context, $modules, array $options ) {
              if ( !is_array( $modules ) ) {
                  $modules = [ $modules ];
              }
      
      
      Severity: Major
      Found in includes/api/ApiHelp.php - About 2 hrs to fix

        Method getQueryInfo has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getQueryInfo() {
                $db = $this->getDatabase();
                $commentQuery = $this->commentStore->getJoin( 'bl_reason' );
                $info = [
                    'tables' => array_merge(
        Severity: Major
        Found in includes/specials/pagers/BlockListPager.php - About 2 hrs to fix

          Method initFromJson has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function initFromJson( JsonDeserializer $deserializer, array $jsonData ): void {
                  parent::initFromJson( $deserializer, $jsonData );
          
                  // WARNING: When changing how this class is serialized, follow the instructions
                  // at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
          Severity: Major
          Found in includes/parser/ParserOutput.php - About 2 hrs to fix

            Method reallyFetchFile has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function reallyFetchFile( $httpOptions = [] ) {
                    $copyUploadProxy = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::CopyUploadProxy );
                    $copyUploadTimeout = MediaWikiServices::getInstance()->getMainConfig()
                        ->get( MainConfigNames::CopyUploadTimeout );
            
            
            Severity: Major
            Found in includes/upload/UploadFromUrl.php - About 2 hrs to fix

              Method getDbResults has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getDbResults( ExistingPageRecord $page, array $params, $relativeRevId, $ts, $tagIds ) {
                      $dbr = $this->dbProvider->getReplicaDatabase();
                      $queryBuilder = $this->revisionStore->newSelectQueryBuilder( $dbr )
                          ->joinComment()
                          ->where( [ 'rev_page' => $page->getId() ] )
              Severity: Major
              Found in includes/Rest/Handler/PageHistoryHandler.php - About 2 hrs to fix

                Method getTrackingCategories has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getTrackingCategories() {
                        $categories = array_merge(
                            self::CORE_TRACKING_CATEGORIES,
                            $this->extensionRegistry->getAttribute( MainConfigNames::TrackingCategories ),
                            $this->options->get( MainConfigNames::TrackingCategories ) // deprecated
                Severity: Major
                Found in includes/Category/TrackingCategories.php - About 2 hrs to fix

                  File MessagesGl.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Method filter has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function filter( $source ) {
                            $tokens = token_get_all( $source );
                            $buffer = null;
                            $output = '';
                            foreach ( $tokens as $token ) {
                    Severity: Major
                    Found in maintenance/includes/MWDoxygenFilter.php - About 2 hrs to fix

                      Method pokeFile has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function pokeFile( $orig, $new ) {
                              $path = $this->filePath( $orig );
                              if ( !file_exists( $path ) ) {
                                  $this->output( "missing file: $path\n" );
                                  $this->killRow( $orig );
                      Severity: Major
                      Found in maintenance/cleanupImages.php - About 2 hrs to fix

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

                            public function testUserExists( $username, $flags = IDBAccessObject::READ_NORMAL ) {
                                $username = $this->userNameUtils->getCanonical( $username, UserRigorOptions::RIGOR_USABLE );
                                if ( $username === false ) {
                                    return false;
                                }
                        includes/auth/LocalPasswordPrimaryAuthenticationProvider.php on lines 188..202

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

                        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

                                'default' => [
                                    'https://3hub.co' => true,
                                    'https://morepro.info' => true,
                                    'https://p.ato.mx' => true,
                                    'https://s.ato.mx' => true,
                        Severity: Major
                        Found in includes/MainConfigSchema.php and 1 other location - About 2 hrs to fix
                        includes/config-schema.php on lines 1811..1827

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

                        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

                                    'CSPFalsePositiveUrls' => [
                                        'https://3hub.co' => true,
                                        'https://morepro.info' => true,
                                        'https://p.ato.mx' => true,
                                        'https://s.ato.mx' => true,
                        Severity: Major
                        Found in includes/config-schema.php and 1 other location - About 2 hrs to fix
                        includes/MainConfigSchema.php on lines 9339..9355

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

                        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

                            public function testUserExists( $username, $flags = IDBAccessObject::READ_NORMAL ) {
                                $username = $this->userNameUtils->getCanonical(
                                    $username, UserRigorOptions::RIGOR_USABLE );
                                if ( $username === false ) {
                                    return false;
                        Severity: Major
                        Found in includes/auth/LocalPasswordPrimaryAuthenticationProvider.php and 1 other location - About 2 hrs to fix
                        includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php on lines 44..56

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

                        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 TraditionalImageGallery.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        use MediaWiki\HookContainer\HookRunner;
                        use MediaWiki\Html\Html;
                        use MediaWiki\Linker\Linker;
                        Severity: Minor
                        Found in includes/gallery/TraditionalImageGallery.php - About 2 hrs to fix

                          File DjVuHandler.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * Handler for DjVu images.
                           *
                           * This program is free software; you can redistribute it and/or modify
                          Severity: Minor
                          Found in includes/media/DjVuHandler.php - About 2 hrs to fix

                            File ApiAuthManagerHelper.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /**
                             * Copyright © 2016 Wikimedia Foundation and contributors
                             *
                             * This program is free software; you can redistribute it and/or modify
                            Severity: Minor
                            Found in includes/api/ApiAuthManagerHelper.php - About 2 hrs to fix

                              File JobQueue.php has 259 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/jobqueue/JobQueue.php - About 2 hrs to fix

                                File moveToExternal.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /**
                                 * Move text from the text table to external storage
                                 *
                                 * This program is free software; you can redistribute it and/or modify
                                Severity: Minor
                                Found in maintenance/storage/moveToExternal.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language