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

                        if ( pi.deprecatedvalues && pi.deprecatedvalues.indexOf( v ) >= 0 ) {
                            optionWidget.$element.addClass( 'mw-apisandbox-deprecated-value' );
                            optionWidget.$label.before(
                                $( '<span>' ).addClass( 'mw-apisandbox-flag' ).text( mw.msg( 'api-help-param-deprecated-label' ) )
                            );
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 459..464

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

        if (that._helper && !o.animate && (/relative/).test(ce.css('position')))
            $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.resizable.js and 1 other location - About 2 hrs to fix
resources/lib/jquery.ui/jquery.ui.resizable.js on lines 728..729

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.UsersMultiselectWidget.prototype.updateHiddenInput = function () {
        if ( '$hiddenInput' in this ) {
            this.$hiddenInput.val( this.getSelectedUsernames().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.TagMultiselectWidget.js on lines 61..68

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

        if (that._helper && !o.animate && (/static/).test(ce.css('position')))
            $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.resizable.js and 1 other location - About 2 hrs to fix
resources/lib/jquery.ui/jquery.ui.resizable.js on lines 725..726

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

                        if ( pi.internalvalues && pi.internalvalues.indexOf( v ) >= 0 ) {
                            optionWidget.$element.addClass( 'mw-apisandbox-internal-value' );
                            optionWidget.$label.before(
                                $( '<span>' ).addClass( 'mw-apisandbox-flag' ).text( mw.msg( 'api-help-param-internal-label' ) )
                            );
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 453..458

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

File SqliteInstaller.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Sqlite-specific installer.
 *
Severity: Minor
Found in includes/installer/SqliteInstaller.php - About 2 hrs to fix

    File LegacyLogger.php has 279 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/debug/logger/LegacyLogger.php - About 2 hrs to fix

      Function setErrors has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      HtmlformChecker.prototype.setErrors = function ( valid, errors, forceReplacement ) {
          let $oldErrorBox,
              showFunc,
              $text,
              replace,
      Severity: Major
      Found in resources/src/mediawiki.special.createaccount/HtmlformChecker.js - About 2 hrs to fix

        Function MwRcfiltersUiMenuSelectWidget has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

          function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
            const _component_cdx_icon = resolveComponent("cdx-icon");
            return !_ctx.isLegend ? (openBlock(), createElementBlock(
              "div",
              {
          Severity: Major
          Found in resources/lib/codex/codex.js - About 2 hrs to fix

            Function fn has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fn(state) {
                  return __async(this, null, function* () {
                    const {
                      placement,
                      rects,
            Severity: Major
            Found in resources/lib/codex/codex.js - About 2 hrs to fix

              Function OoUiPopupWidget has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              OO.ui.PopupWidget = function OoUiPopupWidget( config ) {
                  // Configuration initialization
                  config = config || {};
              
                  // Parent constructor
              Severity: Major
              Found in resources/lib/ooui/oojs-ui-core.js - About 2 hrs to fix

                Function OoUiTextInputWidget has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) {
                    // Configuration initialization
                    config = Object.assign( {
                        labelPosition: 'after'
                    }, config );
                Severity: Major
                Found in resources/lib/ooui/oojs-ui-core.js - About 2 hrs to fix

                  Function _open has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _open: function( event, target, content ) {
                          var tooltip, events, delayedShow,
                              positionOption = $.extend( {}, this.options.position );
                  
                          if ( !content ) {
                  Severity: Major
                  Found in resources/lib/jquery.ui/jquery.ui.tooltip.js - About 2 hrs to fix

                    Function _doKeyDown has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _doKeyDown: function(event) {
                            var inst = $.datepicker._getInst(event.target);
                            var handled = true;
                            var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
                            inst._keyEvent = true;
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.datepicker.js - About 2 hrs to fix

                      Method makeLoad has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function makeLoad( Context $mainContext, array $modules, $only,
                              array $extraQuery = []
                          ) {
                              $rl = $mainContext->getResourceLoader();
                              $chunks = [];
                      Severity: Major
                      Found in includes/ResourceLoader/ClientHtml.php - About 2 hrs to fix

                        Method buildContent has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            final protected function buildContent( Context $context ) {
                                $statsFactory = MediaWikiServices::getInstance()->getStatsFactory();
                                $statStart = microtime( true );
                        
                                // This MUST build both scripts and styles, regardless of whether $context->getOnly()
                        Severity: Major
                        Found in includes/ResourceLoader/Module.php - About 2 hrs to fix

                          Method resyncFiles has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function resyncFiles( array $paths, $resyncMode = true ) {
                                  $status = $this->newStatus();
                          
                                  $fname = __METHOD__;
                                  foreach ( $paths as $path ) {
                          Severity: Major
                          Found in includes/libs/filebackend/FileBackendMultiWrite.php - About 2 hrs to fix

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

                                public function getQueryInfo( $schema = self::SCHEMA_BLOCK ) {
                                    $commentQuery = $this->commentStore->getJoin( 'bl_reason' );
                                    if ( $schema === self::SCHEMA_IPBLOCKS ) {
                                        return [
                                            'tables' => [
                            Severity: Major
                            Found in includes/block/DatabaseBlockStore.php - About 2 hrs to fix

                              Method makeListItem has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function makeListItem(
                                      string $key,
                                      array $item,
                                      array $options = [],
                                      array $linkOptions = []
                              Severity: Major
                              Found in includes/skins/components/SkinComponentListItem.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language