wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method doDBInserts has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function doDBInserts() {
        $now = time();
        $dbw = $this->file->repo->getPrimaryDB();

        $commentStore = MediaWikiServices::getInstance()->getCommentStore();
Severity: Major
Found in includes/filerepo/file/LocalFileDeleteBatch.php - About 3 hrs to fix

    Method processDbResults has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function processDbResults( $res, $page, $params ) {
            $revisions = [];
    
            if ( $res ) {
                $sizes = [];
    Severity: Major
    Found in includes/Rest/Handler/PageHistoryHandler.php - About 3 hrs to fix

      Method doCategoryQuery has 93 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function doCategoryQuery() {
              $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
      
              $this->nextPage = [
                  'page' => null,
      Severity: Major
      Found in includes/Category/CategoryViewer.php - About 3 hrs to fix

        Method rebuildRecentChangesTablePass1 has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function rebuildRecentChangesTablePass1() {
                $dbw = $this->getPrimaryDB();
                $commentStore = $this->getServiceContainer()->getCommentStore();
        
                if ( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) {
        Severity: Major
        Found in maintenance/rebuildrecentchanges.php - About 3 hrs to fix

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

              public function execute() {
                  $backendGroup = $this->getServiceContainer()->getFileBackendGroup();
                  $src = $backendGroup->get( $this->getOption( 'src' ) );
                  $dst = $backendGroup->get( $this->getOption( 'dst' ) );
                  $containers = explode( '|', $this->getOption( 'containers' ) );
          Severity: Major
          Found in maintenance/copyFileBackend.php - About 3 hrs to fix

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

                public function execute() {
                    # text with no html simulates an interface message string or a title
                    $textWithNoHtml = 'This could be an article title';
                    $textWithHtmlSm = 'Before <wrap><in>and</in> another <unclose> <in>word</in></wrap>.';
                    $textWithHtmlLg = str_repeat(
            Severity: Major
            Found in maintenance/benchmarks/benchmarkSanitizer.php - About 3 hrs to fix

              File MessagesCe.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /** Chechen (нохчийн)
               *
               * @file
               * @ingroup Languages
              Severity: Minor
              Found in languages/messages/MessagesCe.php - About 3 hrs to fix

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

                            function sequence( parserSyntax ) {
                                var i, res,
                                    originalPos = pos,
                                    result = [];
                
                
                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 127..145

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

                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 sequence(parserSyntax) {
                        var i, parserRes,
                            originalPos = pos,
                            result = [];
                
                
                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 75..93

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

                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 getSizeAndMetadata( $state, $filename ) {
                        try {
                            $metadata = BitmapMetadataHandler::PNG( $filename );
                        } catch ( TimeoutException $e ) {
                            throw $e;
                Severity: Major
                Found in includes/media/PNGHandler.php and 1 other location - About 3 hrs to fix
                includes/media/GIFHandler.php on lines 40..61

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

                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 getSizeAndMetadata( $state, $filename ) {
                        try {
                            $parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename );
                        } catch ( TimeoutException $e ) {
                            throw $e;
                Severity: Major
                Found in includes/media/GIFHandler.php and 1 other location - About 3 hrs to fix
                includes/media/PNGHandler.php on lines 40..61

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

                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 MwRcfiltersUiSavedLinksListWidget has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const SavedLinksListItemWidget = function MwRcfiltersUiSavedLinksListWidget( model, config ) {
                    config = config || {};
                
                    this.model = model;
                
                
                Severity: Major
                Found in resources/src/mediawiki.rcfilters/ui/SavedLinksListItemWidget.js - About 3 hrs to fix

                  Method doWikiLinks has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function doWikiLinks( $comment, $selfLinkTarget = null, $samePage = false, $wikiId = false ) {
                          return preg_replace_callback(
                              '/
                                  \[\[
                                  \s*+ # ignore leading whitespace, the *+ quantifier disallows backtracking
                  Severity: Major
                  Found in includes/CommentFormatter/CommentParser.php - About 3 hrs to fix

                    Method diffInternal has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function diffInternal( array $from, array $to ) {
                            // remember initial lengths
                            $m = count( $from );
                            $n = count( $to );
                    
                    
                    Severity: Major
                    Found in includes/libs/Diff/DiffEngine.php - About 3 hrs to fix

                      File ContentSecurityPolicy.php has 320 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/Request/ContentSecurityPolicy.php - About 3 hrs to fix

                        Method __construct has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function __construct( $siteName, $admin = null, array $options = [] ) {
                                global $wgPasswordPolicy;
                        
                                parent::__construct();
                        
                        
                        Severity: Major
                        Found in includes/installer/CliInstaller.php - About 3 hrs to fix

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

                              public function execute() {
                                  $params = $this->extractRequestParams();
                          
                                  $pageObj = $this->getTitleOrPageId( $params, 'fromdbmaster' );
                                  $titleObj = $pageObj->getTitle();
                          Severity: Major
                          Found in includes/api/ApiProtect.php - About 3 hrs to fix

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

                                public function execute() {
                                    $config = $this->getConfig();
                                    $feedClasses = $config->get( MainConfigNames::FeedClasses );
                                    $params = [];
                                    $feedItems = [];
                            Severity: Major
                            Found in includes/api/ApiFeedWatchlist.php - About 3 hrs to fix

                              Context has 30 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Context implements MessageLocalizer {
                                  public const DEFAULT_LANG = 'qqx';
                                  public const DEFAULT_SKIN = 'fallback';
                              
                                  /** @internal For use in ResourceLoader classes. */
                              Severity: Minor
                              Found in includes/ResourceLoader/Context.php - About 3 hrs to fix

                                RevisionRecord has 30 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                abstract class RevisionRecord implements WikiAwareEntity {
                                    use LegacyArticleIdAccess;
                                    use NonSerializableTrait;
                                    use WikiAwareEntityTrait;
                                
                                
                                Severity: Minor
                                Found in includes/Revision/RevisionRecord.php - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language