wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function getAllowedParams() {
        return [
            'prop' => [
                ParamValidator::PARAM_ISMULTI => true,
                ParamValidator::PARAM_DEFAULT => 'timestamp|user',
Severity: Major
Found in includes/api/ApiQueryImageInfo.php - About 2 hrs to fix

    Method substituteResultWithError has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function substituteResultWithError( Throwable $e ) {
            $result = $this->getResult();
            $formatter = $this->getErrorFormatter();
            $config = $this->getConfig();
            $errorCodes = [];
    Severity: Major
    Found in includes/api/ApiMain.php - About 2 hrs to fix

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

          public function execute() {
              $performer = $this->getUser();
              $params = $this->extractRequestParams();
      
              $this->requireOnlyOneParameter( $params, 'id', 'user', 'userid' );
      Severity: Major
      Found in includes/api/ApiUnblock.php - About 2 hrs to fix

        Method runQuery has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function runQuery( $resultPageSet, $limit, $start, $startId, $end ) {
                $params = $this->extractRequestParams();
        
                $this->resetQueryParams();
                $this->addTables( 'page' );
        Severity: Major
        Found in includes/api/ApiQueryRandom.php - About 2 hrs to fix

          Method changePageLanguage has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function changePageLanguage( IContextSource $context, Title $title,
                  $newLanguage, $reason = "", array $tags = [], IDatabase $dbw = null ) {
                  // Get the default language for the wiki
                  $defLang = $context->getConfig()->get( MainConfigNames::LanguageCode );
          
          
          Severity: Major
          Found in includes/specials/SpecialPageLanguage.php - About 2 hrs to fix

            Method formatValue has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function formatValue( $field, $value ) {
                    $linkRenderer = $this->getLinkRenderer();
                    switch ( $field ) {
                        case 'thumb':
                            $opt = [ 'time' => wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) ];
            Severity: Major
            Found in includes/specials/pagers/ImageListPager.php - About 2 hrs to fix

              Method claimRandom has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function claimRandom( $uuid, $rand, $gte ) {
                      $dbw = $this->getPrimaryDB();
                      // Check cache to see if the queue has <= OFFSET items
                      $tinyQueue = $this->wanCache->get( $this->getCacheKey( 'small' ) );
              
              
              Severity: Major
              Found in includes/jobqueue/JobQueueDB.php - About 2 hrs to fix

                Method parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function parse(
                        $text, PageReference $page, ParserOptions $options,
                        $linestart = true, $clearState = true, $revid = null
                    ) {
                        if ( $clearState ) {
                Severity: Major
                Found in includes/parser/Parser.php - About 2 hrs to fix

                  Method getExistsWarning has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getExistsWarning( $file ) {
                          if ( $file->exists() ) {
                              return [ 'warning' => 'exists', 'file' => $file ];
                          }
                  
                  
                  Severity: Major
                  Found in includes/upload/UploadBase.php - About 2 hrs to fix

                    Method parseQuery has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function parseQuery( $filteredText, $fulltext ) {
                            $lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); // Minus syntax chars (" and *)
                            $searchon = '';
                            $this->searchTerms = [];
                    
                    
                    Severity: Major
                    Found in includes/search/SearchMySQL.php - About 2 hrs to fix

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

                          public function execute() {
                              $lastName = $this->getOption( 'start', '' );
                      
                              $repo = $this->getServiceContainer()->getRepoGroup()->getLocalRepo();
                              $dbr = $repo->getReplicaDB();
                      Severity: Major
                      Found in maintenance/findMissingFiles.php - About 2 hrs to fix

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

                            public function execute() {
                                $benches = [];
                        
                                $schemaSource = new ReflectionSchemaSource( MainConfigSchema::class );
                                $schema = $schemaSource->load();
                        Severity: Major
                        Found in maintenance/benchmarks/benchmarkSettings.php - About 2 hrs to fix

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

                              public function execute() {
                                  global $wgHTCPRouting;
                          
                                  if ( $this->hasOption( 'htcp-dest' ) ) {
                                      $parts = explode( ':', $this->getOption( 'htcp-dest' ), 2 );
                          Severity: Major
                          Found in maintenance/purgeChangedPages.php - About 2 hrs to fix

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

                                public function execute() {
                                    $dbw = $this->getDB( DB_PRIMARY );
                                    $batchSize = $this->getBatchSize();
                            
                                    if ( !$dbw->tableExists( 'page_restrictions', __METHOD__ ) ) {
                            Severity: Major
                            Found in maintenance/updateRestrictions.php - About 2 hrs to fix

                              File MessagesMr.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              /** Marathi (मराठी)
                               *
                               * @file
                               * @ingroup Languages
                              Severity: Minor
                              Found in languages/messages/MessagesMr.php - About 2 hrs to fix

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

                                OO.ui.ToolGroup.prototype.onMouseOverFocus = function ( e ) {
                                    const tool = this.findTargetTool( e );
                                
                                    if ( this.pressed && this.pressed === tool ) {
                                        this.pressed.setActive( true );
                                Severity: Major
                                Found in resources/lib/ooui/oojs-ui-toolbars.js and 1 other location - About 2 hrs to fix
                                resources/lib/ooui/oojs-ui-toolbars.js on lines 1352..1358

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

                                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

                                        ordinal: function (number, period) {
                                            switch (period) {
                                                // Words with masculine grammatical gender: mois, trimestre, jour
                                                default:
                                                case 'M':
                                Severity: Major
                                Found in resources/lib/moment/locale/fr-ch.js and 1 other location - About 2 hrs to fix
                                resources/lib/moment/locale/fr-ca.js on lines 59..75

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

                                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.ToolGroup.prototype.onMouseOutBlur = function ( e ) {
                                    const tool = this.findTargetTool( e );
                                
                                    if ( this.pressed && this.pressed === tool ) {
                                        this.pressed.setActive( false );
                                Severity: Major
                                Found in resources/lib/ooui/oojs-ui-toolbars.js and 1 other location - About 2 hrs to fix
                                resources/lib/ooui/oojs-ui-toolbars.js on lines 1338..1344

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

                                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

                                        ordinal: function (number, period) {
                                            switch (period) {
                                                // Words with masculine grammatical gender: mois, trimestre, jour
                                                default:
                                                case 'M':
                                Severity: Major
                                Found in resources/lib/moment/locale/fr-ca.js and 1 other location - About 2 hrs to fix
                                resources/lib/moment/locale/fr-ch.js on lines 59..75

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

                                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.SearchInputWidget.prototype.onIndicatorKeyDown = function ( e ) {
                                    if ( e.keyCode === OO.ui.Keys.ENTER ) {
                                        // Clear the text field
                                        this.setValue( '' );
                                        this.focus();
                                Severity: Major
                                Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
                                resources/lib/ooui/oojs-ui-core.js on lines 12115..12122

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

                                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