wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function __construct() {
        parent::__construct();

        $this->addDescription( 'Script to update image metadata records' );
        $this->setBatchSize( 200 );
Severity: Major
Found in maintenance/refreshImageMetadata.php - About 2 hrs to fix

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

        public function execute() {
            if ( $this->hasOption( 'd' ) ) {
                $d = $this->getOption( 'd' );
                if ( $d > 0 ) {
                    LoggerFactory::registerProvider( new ConsoleSpi );
    Severity: Major
    Found in maintenance/eval.php - About 2 hrs to fix

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

                      if ( pi.internal !== undefined ) {
                          $desc = $( '<span>' ).addClass( 'apihelp-internal' ).text( mw.msg( 'api-help-param-internal' ) )
                              .add( document.createTextNode( mw.msg( 'word-separator' ) ) ).add( $desc );
                      }
      Severity: Major
      Found in resources/src/mediawiki.special.apisandbox/apisandbox.js and 1 other location - About 2 hrs to fix
      resources/src/mediawiki.special.apisandbox/apisandbox.js on lines 1756..1759

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

      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

              calendar: {
                  sameDay: '[Hoje às] LT',
                  nextDay: '[Amanhã às] LT',
                  nextWeek: 'dddd [às] LT',
                  lastDay: '[Ontem às] LT',
      Severity: Major
      Found in resources/lib/moment/locale/pt.js and 1 other location - About 2 hrs to fix
      resources/lib/moment/locale/pt-br.js on lines 33..44

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

      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

              calendar: {
                  sameDay: '[Hoje às] LT',
                  nextDay: '[Amanhã às] LT',
                  nextWeek: 'dddd [às] LT',
                  lastDay: '[Ontem às] LT',
      Severity: Major
      Found in resources/lib/moment/locale/pt-br.js and 1 other location - About 2 hrs to fix
      resources/lib/moment/locale/pt.js on lines 33..44

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

      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

      FiltersViewModel.prototype.areTagsEffectivelyInverted = function () {
          return this.getTagsInvertModel().isSelected() &&
              this.findSelectedItems().some( ( itemModel ) => itemModel.getGroupModel().getName() === 'tagfilter' );
      };
      Severity: Major
      Found in resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js and 1 other location - About 2 hrs to fix
      resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js on lines 917..920

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

      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

                      if ( pi.deprecated !== undefined ) {
                          $desc = $( '<span>' ).addClass( 'apihelp-deprecated' ).text( mw.msg( 'api-help-param-deprecated' ) )
                              .add( document.createTextNode( mw.msg( 'word-separator' ) ) ).add( $desc );
                      }
      Severity: Major
      Found in resources/src/mediawiki.special.apisandbox/apisandbox.js and 1 other location - About 2 hrs to fix
      resources/src/mediawiki.special.apisandbox/apisandbox.js on lines 1760..1763

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

      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

      FiltersViewModel.prototype.areNamespacesEffectivelyInverted = function () {
          return this.getNamespacesInvertModel().isSelected() &&
              this.findSelectedItems().some( ( itemModel ) => itemModel.getGroupModel().getName() === 'namespace' );
      };
      Severity: Major
      Found in resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js and 1 other location - About 2 hrs to fix
      resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js on lines 932..935

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

      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

              if ( count( $otherAutoblockLink ) ) {
                  $out->addHTML(
                      Html::rawElement(
                          'h2',
                          [],
      Severity: Major
      Found in includes/specials/SpecialAutoblockList.php and 1 other location - About 2 hrs to fix
      includes/specials/SpecialBlockList.php on lines 293..310

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

      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

          public function __construct(
              ServiceOptions $options,
              Spi $loggerFactory,
              PermissionManager $permissionManager,
              HookContainer $hookContainer,
      Severity: Major
      Found in includes/editpage/Constraint/EditConstraintFactory.php and 2 other locations - About 2 hrs to fix
      includes/jobqueue/JobRunner.php on lines 103..120
      includes/logging/LogFormatterFactory.php on lines 25..42

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

      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

          public function __construct(
              ServiceOptions $serviceOptions,
              ILBFactory $lbFactory,
              JobQueueGroup $jobQueueGroup,
              ReadOnlyMode $readOnlyMode,
      Severity: Major
      Found in includes/jobqueue/JobRunner.php and 2 other locations - About 2 hrs to fix
      includes/editpage/Constraint/EditConstraintFactory.php on lines 83..112
      includes/logging/LogFormatterFactory.php on lines 25..42

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

      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

              if ( count( $otherBlockLink ) ) {
                  $out->addHTML(
                      Html::rawElement(
                          'h2',
                          [],
      Severity: Major
      Found in includes/specials/SpecialBlockList.php and 1 other location - About 2 hrs to fix
      includes/specials/SpecialAutoblockList.php on lines 178..197

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

      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

          public function __construct(
              ServiceOptions $options,
              ObjectFactory $objectFactory,
              HookContainer $hookContainer,
              LinkRenderer $linkRenderer,
      Severity: Major
      Found in includes/logging/LogFormatterFactory.php and 2 other locations - About 2 hrs to fix
      includes/editpage/Constraint/EditConstraintFactory.php on lines 83..112
      includes/jobqueue/JobRunner.php on lines 103..120

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

      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 MWExceptionRenderer.php has 264 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/exception/MWExceptionRenderer.php - About 2 hrs to fix

        File MessagesHu.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          Consider simplifying this complex logical expression.
          Open

                                  if ( forward && useCache ) {
          
                                      // Seek `elem` from a previously-cached index
                                      outerCache = parent[ expando ] || ( parent[ expando ] = {} );
                                      cache = outerCache[ type ] || [];
          Severity: Critical
          Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$1 ||
                  windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
                  strategy < 0 || strategy > Z_FIXED || (windowBits === 8 && wrap !== 1)) {
                  return err(strm, Z_STREAM_ERROR);
                }
            Severity: Critical
            Found in resources/lib/pako/pako_deflate.js - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                      if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
                        strend = s.strstart + MAX_MATCH;
                        do {
                          /*jshint noempty:false*/
                        } while (prev === _win[++scan] && prev === _win[++scan] &&
              Severity: Critical
              Found in resources/lib/pako/pako_deflate.js - About 2 hrs to fix

                MutableRevisionRecord has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class MutableRevisionRecord extends RevisionRecord {
                
                    /**
                     * Returns an incomplete MutableRevisionRecord which uses $parent as its
                     * parent revision, and inherits all slots form it. If saved unchanged,
                Severity: Minor
                Found in includes/Revision/MutableRevisionRecord.php - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ( $parserOutput->getOutputFlag( ParserOutputFlags::VARY_REVISION ) ) {
                              // If {{PAGEID}} resolved to 0, then that word need to resolve to the actual page ID
                              $logger->info( "$varyMsg (vary-revision)", $context );
                              return true;
                          } elseif (
                  Severity: Critical
                  Found in includes/Revision/RenderedRevision.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language