wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method delimiterReplaceCallback has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function delimiterReplaceCallback( $startDelim, $endDelim, $callback,
        $subject, $flags = ''
    ) {
        $inputPos = 0;
        $outputPos = 0;
Severity: Major
Found in includes/libs/StringUtils.php - About 2 hrs to fix

    Method acquireTarget has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function acquireTarget(
            DatabaseBlock $block,
            IDatabase $dbw,
            $expectedTargetCount
        ) {
    Severity: Major
    Found in includes/block/DatabaseBlockStore.php - About 2 hrs to fix

      Method mteiToBengali has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function mteiToBengali( $text ) {
              $chars = mb_str_split( $text );
              $l = count( $chars );
              $i = 0;
              while ( $i < $l ) {
      Severity: Major
      Found in includes/language/converters/MniConverter.php - About 2 hrs to fix

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

            public function execute() {
                $this->useTransactionalTimeLimit();
                $params = $this->extractRequestParams();
        
                $this->requireMaxOneParameter( $params, 'namespace', 'rootpage' );
        Severity: Major
        Found in includes/api/ApiImport.php - About 2 hrs to fix

          Method appendExtensions has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function appendExtensions( $property ) {
                  $data = [];
                  $credits = SpecialVersion::getCredits(
                      ExtensionRegistry::getInstance(),
                      $this->getConfig()
          Severity: Major
          Found in includes/api/ApiQuerySiteinfo.php - About 2 hrs to fix

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

                public function execute( $par ) {
                    $this->setHeaders();
                    $this->outputHeader();
                    $this->addHelpLink( 'Help:Blocking_users' );
                    $out = $this->getOutput();
            Severity: Major
            Found in includes/specials/SpecialBlockList.php - About 2 hrs to fix

              Method getBlockListPager has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getBlockListPager() {
                      $conds = [];
                      $db = $this->getDB();
              
                      if ( $this->target !== '' ) {
              Severity: Major
              Found in includes/specials/SpecialBlockList.php - About 2 hrs to fix

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

                    public function getQueryInfo() {
                        $dbr = $this->getDatabase();
                        $conds = [];
                        $options = [];
                
                
                Severity: Major
                Found in includes/specials/pagers/UsersPager.php - About 2 hrs to fix

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

                      public function execute( $par ) {
                          $this->setHeaders();
                          $this->outputHeader();
                  
                          $this->filename = $par ?? $this->getRequest()->getText( 'filename' );
                  Severity: Major
                  Found in includes/specials/SpecialFileDuplicateSearch.php - About 2 hrs to fix

                    Method getParserOutput has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getParserOutput(
                            RevisionRenderer $renderer,
                            ParserCache $parserCache,
                            WikiPage $page,
                            StatsFactory $stats
                    Severity: Major
                    Found in includes/jobqueue/jobs/RefreshLinksJob.php - About 2 hrs to fix

                      Method create has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function create(
                              PageIdentity $pageId,
                              ?UserIdentity $user = null,
                              $revision = null,
                              ?string $unused = null, /* Added to mollify CI with cross-repo uses */
                      Severity: Major
                      Found in includes/parser/Parsoid/Config/PageConfigFactory.php - About 2 hrs to fix

                        File UploadStash.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Temporary storage for uploaded files.
                         *
                         * This program is free software; you can redistribute it and/or modify
                        Severity: Minor
                        Found in includes/upload/UploadStash.php - About 2 hrs to fix

                          Method resolveStub has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function resolveStub( $row, $dryRun ) {
                                  $id = $row->old_id;
                                  $stub = unserialize( $row->old_text );
                                  $flags = SqlBlobStore::explodeFlags( $row->old_flags );
                          
                          
                          Severity: Major
                          Found in maintenance/storage/resolveStubs.php - About 2 hrs to fix

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

                                public function execute() {
                                    $dbr = $this->getReplicaDB();
                                    $dbw = $this->getPrimaryDB();
                            
                                    $dryRun = true;
                            Severity: Major
                            Found in maintenance/fixMergeHistoryCorruption.php - About 2 hrs to fix

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

                                  return {
                                    rootElement,
                                    input,
                                    computedInputValue,
                                    rootClasses,
                              Severity: Major
                              Found in resources/lib/codex/codex.js and 2 other locations - About 2 hrs to fix
                              resources/lib/codex/codex.js on lines 5710..5728
                              resources/lib/codex/codex.js on lines 6601..6619

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

                              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 3 locations. Consider refactoring.
                              Open

                                  return {
                                    close,
                                    cdxIconClose: X3,
                                    labelId,
                                    rootClasses,
                              Severity: Major
                              Found in resources/lib/codex/codex.js and 2 other locations - About 2 hrs to fix
                              resources/lib/codex/codex.js on lines 1889..1907
                              resources/lib/codex/codex.js on lines 6601..6619

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

                              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 3 locations. Consider refactoring.
                              Open

                                  return {
                                    rootElement,
                                    textInput,
                                    menu,
                                    menuId,
                              Severity: Major
                              Found in resources/lib/codex/codex.js and 2 other locations - About 2 hrs to fix
                              resources/lib/codex/codex.js on lines 1889..1907
                              resources/lib/codex/codex.js on lines 5710..5728

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

                              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

                                              for ( let m = 0; m < 12; m++ ) {
                                                  items.push(
                                                      $( '<div>' )
                                                          .addClass( 'mw-widget-calendarWidget-item mw-widget-calendarWidget-month' )
                                                          .toggleClass( 'mw-widget-calendarWidget-item-selected', currentMonth.isSame( selected, 'month' ) )
                              Severity: Major
                              Found in resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js and 1 other location - About 2 hrs to fix
                              resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js on lines 292..301

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

                              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

                                              for ( let y = 0; y < 20; y++ ) {
                                                  items.push(
                                                      $( '<div>' )
                                                          .addClass( 'mw-widget-calendarWidget-item mw-widget-calendarWidget-year' )
                                                          .toggleClass( 'mw-widget-calendarWidget-item-selected', currentYear.isSame( selected, 'year' ) )
                              Severity: Major
                              Found in resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js and 1 other location - About 2 hrs to fix
                              resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js on lines 254..263

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

                              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

                                  mw.widgets.TagMultiselectWidget.prototype.updateHiddenInput = function () {
                                      if ( '$hiddenInput' in this ) {
                                          this.$hiddenInput.val( this.getValue().join( '\n' ) );
                                          // Trigger a 'change' event as if a user edited the text
                                          // (it is not triggered when changing the value from JS code).
                              resources/src/mediawiki.widgets/mw.widgets.UsersMultiselectWidget.js on lines 212..219

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

                              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