wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

        case "ArrowUp":
          maybePrevent();
          if (props.expanded) {
            if (highlightedMenuItem.value === null) {
              handleMenuItemChange("highlightedViaKeyboard", findFirstSelectedMenuItem());
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 2 hrs to fix
resources/lib/codex/codex.js on lines 2926..2937

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

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

OO.ui.NumberInputWidget.prototype.setReadOnly = function () {
    // Parent method
    OO.ui.NumberInputWidget.super.prototype.setReadOnly.apply( this, arguments );
    this.updateControlsDisabled();
    return this;
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
resources/lib/ooui/oojs-ui-core.js on lines 12718..12723
resources/lib/ooui/oojs-ui-core.js on lines 12728..12733

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

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 enhancePanel( panel ) {
            if ( !panel.$element.data( 'mw-section-infused' ) ) {
                panel.$element.removeClass( 'mw-htmlform-autoinfuse-lazy' );
                mw.hook( 'htmlform.enhance' ).fire( panel.$element );
                panel.$element.data( 'mw-section-infused', true );
Severity: Major
Found in resources/src/mediawiki.special.preferences.ooui/tabs.js and 1 other location - About 2 hrs to fix
resources/src/mediawiki.special.preferences.ooui/mobile.js on lines 11..17

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

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.TableWidgetModel.prototype.setData = function ( data ) {
    if ( Array.isArray( data ) ) {
        this.data = data;

        this.verifyData();
resources/src/mediawiki.widgets/Table/mw.widgets.RowWidgetModel.js on lines 187..194

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

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

        case "ArrowDown":
          maybePrevent();
          if (props.expanded) {
            if (highlightedMenuItem.value === null) {
              handleMenuItemChange("highlightedViaKeyboard", findFirstSelectedMenuItem());
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 2 hrs to fix
resources/lib/codex/codex.js on lines 2914..2925

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

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.RowWidgetModel.prototype.setData = function ( data ) {
    if ( Array.isArray( data ) ) {
        this.data = data;

        this.verifyData();
resources/src/mediawiki.widgets/Table/mw.widgets.TableWidgetModel.js on lines 274..281

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

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

    var prototypeMin = deprecate(
            'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
            function () {
                var other = createLocal.apply(null, arguments);
                if (this.isValid() && other.isValid()) {
Severity: Major
Found in resources/lib/moment/moment.js and 1 other location - About 2 hrs to fix
resources/lib/moment/moment.js on lines 3042..3052

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

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

    windowManager.on( 'opening', ( win ) => {
        if ( !win.$body.data( 'mw-section-infused' ) ) {
            win.$body.removeClass( 'mw-htmlform-autoinfuse-lazy' );
            mw.hook( 'htmlform.enhance' ).fire( win.$body );
            win.$body.data( 'mw-section-infused', true );
Severity: Major
Found in resources/src/mediawiki.special.preferences.ooui/mobile.js and 1 other location - About 2 hrs to fix
resources/src/mediawiki.special.preferences.ooui/tabs.js on lines 25..31

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

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

        prototypeMax = deprecate(
            'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
            function () {
                var other = createLocal.apply(null, arguments);
                if (this.isValid() && other.isValid()) {
Severity: Major
Found in resources/lib/moment/moment.js and 1 other location - About 2 hrs to fix
resources/lib/moment/moment.js on lines 3031..3041

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

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

<?php

namespace MediaWiki\Page;

use EmptyIterator;
Severity: Minor
Found in includes/page/PageStore.php - About 2 hrs to fix

    File MessagesRo.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /** Romanian (română)
     *
     * @file
     * @ingroup Languages
    Severity: Minor
    Found in languages/messages/MessagesRo.php - About 2 hrs to fix

      File MessagesSk.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /** Slovak (slovenčina)
       *
       * @file
       * @ingroup Languages
      Severity: Minor
      Found in languages/messages/MessagesSk.php - About 2 hrs to fix

        File MessagesQu.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /** Quechua (Runa Simi)
         *
         * @file
         * @ingroup Languages
        Severity: Minor
        Found in languages/messages/MessagesQu.php - About 2 hrs to fix

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

                  if ( isset( $params['to'] ) ) {
                      $toTitle = Title::newFromText( $params['to'] );
                      if ( !$toTitle || $toTitle->isExternal() ) {
                          $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['to'] ) ] );
                      }
          Severity: Major
          Found in includes/api/ApiMergeHistory.php and 1 other location - About 2 hrs to fix
          includes/api/ApiMergeHistory.php on lines 62..72

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

          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

          $specialPageAliases = [
              'Confirmemail'              => [ 'Orait_long_imel' ],
              'Contributions'             => [ 'Ol_senis_bilong_yusa' ],
              'CreateAccount'             => [ 'Mekim_nupela_login' ],
              'Emailuser'                 => [ 'Imel_yusa' ],
          Severity: Major
          Found in languages/messages/MessagesTpi.php and 1 other location - About 2 hrs to fix
          languages/messages/MessagesIg.php on lines 42..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 125.

          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 ( isset( $params['from'] ) ) {
                      $fromTitle = Title::newFromText( $params['from'] );
                      if ( !$fromTitle || $fromTitle->isExternal() ) {
                          $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['from'] ) ] );
                      }
          Severity: Major
          Found in includes/api/ApiMergeHistory.php and 1 other location - About 2 hrs to fix
          includes/api/ApiMergeHistory.php on lines 74..84

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

          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

          $specialPageAliases = [
              'Allpages'                  => [ 'IhüNílé' ],
              'Blankpage'                 => [ 'HịcháIhü' ],
              'Export'                    => [ 'MēKọFùtá' ],
              'Filepath'                  => [ 'UzọrAkwúkwóOrünotu' ],
          Severity: Major
          Found in languages/messages/MessagesIg.php and 1 other location - About 2 hrs to fix
          languages/messages/MessagesTpi.php on lines 34..48

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

          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

          CodexModule has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class CodexModule extends FileModule {
              protected const CODEX_DEFAULT_LIBRARY_DIR = 'resources/lib/codex';
              private const CODEX_MODULE_DEPENDENCIES = [ 'vue' ];
          
              /** @var array<string,string>|null */
          Severity: Minor
          Found in includes/ResourceLoader/CodexModule.php - About 2 hrs to fix

            ManifoldTextDiffer has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class ManifoldTextDiffer implements TextDiffer {
                /** @var MessageLocalizer */
                private $localizer;
                /** @var Language|null */
                private $contentLanguage;
            Severity: Minor
            Found in includes/diff/TextDiffer/ManifoldTextDiffer.php - About 2 hrs to fix

              TransactionProfiler has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class TransactionProfiler implements LoggerAwareInterface {
                  /** @var LoggerInterface */
                  private $logger;
                  /** @var StatsFactory */
                  private $statsFactory;
              Severity: Minor
              Found in includes/libs/rdbms/TransactionProfiler.php - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language