wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

<?php
/** Karekare (Karai-karai)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesKai.php and 8 other locations - About 2 hrs to fix
languages/messages/MessagesGd.php on lines 1..25
languages/messages/MessagesGv.php on lines 1..25
languages/messages/MessagesIlo.php on lines 1..25
languages/messages/MessagesJbo.php on lines 1..25
languages/messages/MessagesNup.php on lines 1..28
languages/messages/MessagesRw.php on lines 1..28
languages/messages/MessagesSs.php on lines 1..27
languages/messages/MessagesXh.php on lines 1..27

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

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

<?php
/** Swazi (siSwati)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesSs.php and 8 other locations - About 2 hrs to fix
languages/messages/MessagesGd.php on lines 1..25
languages/messages/MessagesGv.php on lines 1..25
languages/messages/MessagesIlo.php on lines 1..25
languages/messages/MessagesJbo.php on lines 1..25
languages/messages/MessagesKai.php on lines 1..26
languages/messages/MessagesNup.php on lines 1..28
languages/messages/MessagesRw.php on lines 1..28
languages/messages/MessagesXh.php on lines 1..27

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

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

<?php
/** Xhosa (isiXhosa)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesXh.php and 8 other locations - About 2 hrs to fix
languages/messages/MessagesGd.php on lines 1..25
languages/messages/MessagesGv.php on lines 1..25
languages/messages/MessagesIlo.php on lines 1..25
languages/messages/MessagesJbo.php on lines 1..25
languages/messages/MessagesKai.php on lines 1..26
languages/messages/MessagesNup.php on lines 1..28
languages/messages/MessagesRw.php on lines 1..28
languages/messages/MessagesSs.php on lines 1..27

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

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

        foreach ( $this->mExtensionData as $key => $value ) {
            if ( is_array( $value ) && isset( $value[self::MW_MERGE_STRATEGY_KEY] ) ) {
                $strategy = $value[self::MW_MERGE_STRATEGY_KEY];
                foreach ( $value as $item => $ignore ) {
                    if ( $item !== self::MW_MERGE_STRATEGY_KEY ) {
Severity: Major
Found in includes/parser/ParserOutput.php and 1 other location - About 2 hrs to fix
includes/parser/ParserOutput.php on lines 2606..2626

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

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

<?php
/** Iloko (Ilokano)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesIlo.php and 8 other locations - About 2 hrs to fix
languages/messages/MessagesGd.php on lines 1..25
languages/messages/MessagesGv.php on lines 1..25
languages/messages/MessagesJbo.php on lines 1..25
languages/messages/MessagesKai.php on lines 1..26
languages/messages/MessagesNup.php on lines 1..28
languages/messages/MessagesRw.php on lines 1..28
languages/messages/MessagesSs.php on lines 1..27
languages/messages/MessagesXh.php on lines 1..27

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

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

<?php
/** Scottish Gaelic (Gàidhlig)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesGd.php and 8 other locations - About 2 hrs to fix
languages/messages/MessagesGv.php on lines 1..25
languages/messages/MessagesIlo.php on lines 1..25
languages/messages/MessagesJbo.php on lines 1..25
languages/messages/MessagesKai.php on lines 1..26
languages/messages/MessagesNup.php on lines 1..28
languages/messages/MessagesRw.php on lines 1..28
languages/messages/MessagesSs.php on lines 1..27
languages/messages/MessagesXh.php on lines 1..27

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

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 __construct(
        ServiceOptions $options,
        LoggerInterface $logger,
        ActorStoreFactory $actorStoreFactory,
        BlockRestrictionStore $blockRestrictionStore,
Severity: Major
Found in includes/block/DatabaseBlockStore.php and 1 other location - About 2 hrs to fix
includes/page/RollbackPage.php on lines 96..126

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

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

    protected function addField( $table, $field, $patch, $fullpath = false ) {
        if ( !$this->doTable( $table ) ) {
            return true;
        }

Severity: Major
Found in includes/installer/DatabaseUpdater.php and 1 other location - About 2 hrs to fix
includes/installer/DatabaseUpdater.php on lines 875..889

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

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

    protected function addIndex( $table, $index, $patch, $fullpath = false ) {
        if ( !$this->doTable( $table ) ) {
            return true;
        }

Severity: Major
Found in includes/installer/DatabaseUpdater.php and 1 other location - About 2 hrs to fix
includes/installer/DatabaseUpdater.php on lines 847..861

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

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

        foreach ( $this->mJsConfigVars as $key => $value ) {
            if ( is_array( $value ) && isset( $value[self::MW_MERGE_STRATEGY_KEY] ) ) {
                $strategy = $value[self::MW_MERGE_STRATEGY_KEY];
                foreach ( $value as $item => $ignore ) {
                    if ( $item !== self::MW_MERGE_STRATEGY_KEY ) {
Severity: Major
Found in includes/parser/ParserOutput.php and 1 other location - About 2 hrs to fix
includes/parser/ParserOutput.php on lines 2627..2647

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

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 __construct(
        ServiceOptions $options,
        IConnectionProvider $dbProvider,
        UserFactory $userFactory,
        ReadOnlyMode $readOnlyMode,
Severity: Major
Found in includes/page/RollbackPage.php and 1 other location - About 2 hrs to fix
includes/block/DatabaseBlockStore.php on lines 94..125

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

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

<?php

use MediaWiki\Json\FormatJson;
use MediaWiki\Registration\ExtensionProcessor;
use MediaWiki\Registration\ExtensionRegistry;
Severity: Minor
Found in maintenance/convertExtensionToRegistration.php - About 2 hrs to fix

    Function commafyNumber has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function commafyNumber( value, pattern, options ) {
            let padLength,
                patternDigits,
                index,
                whole,
    Severity: Major
    Found in resources/src/mediawiki.language/mediawiki.language.numbers.js - About 2 hrs to fix

      Function _sfc_render$k has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
        const _component_cdx_menu_item = resolveComponent("cdx-menu-item");
        const _component_cdx_progress_bar = resolveComponent("cdx-progress-bar");
        return withDirectives((openBlock(), createElementBlock(
          "div",
      Severity: Major
      Found in resources/lib/codex/codex.js - About 2 hrs to fix

        Function shift$1 has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const shift$1 = function(options) {
          if (options === void 0) {
            options = {};
          }
          return {
        Severity: Major
        Found in resources/lib/codex/codex.js - About 2 hrs to fix

          Function closeWindow has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          OO.ui.WindowManager.prototype.closeWindow = function ( win, data ) {
              const compatClosing = $.Deferred();
              let lifecycle = this.lifecycle;
          
              // Argument handling
          Severity: Major
          Found in resources/lib/ooui/oojs-ui-windows.js - About 2 hrs to fix

            Method getScript has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getScript( Context $context ) {
                    global $IP;
                    $conf = $this->getConfig();
            
                    if ( $context->getOnly() !== 'scripts' ) {
            Severity: Major
            Found in includes/ResourceLoader/StartUpModule.php - About 2 hrs to fix

              Method runMultiCurl has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function runMultiCurl( array $reqs, array $opts ) {
                      $chm = $this->getCurlMulti( $opts );
              
                      $selectTimeout = $this->getSelectTimeout( $opts );
              
              
              Severity: Major
              Found in includes/libs/http/MultiHttpClient.php - About 2 hrs to fix

                Method doTransform has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
                        if ( !$this->normaliseParams( $image, $params ) ) {
                            return new TransformParameterError( $params );
                        }
                        $clientWidth = $params['width'];
                Severity: Major
                Found in includes/media/SvgHandler.php - About 2 hrs to fix

                  Method getBenefitsContainerHtml has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getBenefitsContainerHtml(): string {
                          $benefitsContainer = '';
                          $this->getOutput()->addModuleStyles( [ 'oojs-ui.styles.icons-user' ] );
                          if ( $this->isSignup() && $this->showExtraInformation() ) {
                              if ( !$this->getUser()->isTemp() ) {
                  Severity: Major
                  Found in includes/specialpage/LoginSignupSpecialPage.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language