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

            createElementVNode(
              "div",
              {
                ref: "focusTrapStart",
                tabindex: "0",
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 1 hr to fix
resources/lib/codex/codex.js on lines 5913..5923

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

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.clear = function () {
    this.data = [];
    this.verifyData();

    this.emit( 'clear', false );
resources/src/mediawiki.widgets/Table/mw.widgets.RowWidgetModel.js on lines 281..286

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

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

      _ctx.$slots.description && _ctx.$slots.description().length > 0 ? (openBlock(), createElementBlock("span", _hoisted_8$1, [
        renderSlot(_ctx.$slots, "description")
      ])) : createCommentVNode("v-if", true)
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 1 hr to fix
resources/lib/codex/codex.js on lines 8562..8564

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

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 ( error ) {
        compatClosing.reject( new OO.ui.Error( error ) );
        lifecycle.deferreds.closing.reject( new OO.ui.Error( error ) );
        return lifecycle;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-windows.js and 1 other location - About 1 hr to fix
resources/lib/ooui/oojs-ui-windows.js on lines 1402..1406

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

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.clear = function () {
    this.data = [];
    this.verifyData();

    this.emit( 'clear', false );
resources/src/mediawiki.widgets/Table/mw.widgets.TableWidgetModel.js on lines 439..444

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

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

        top: function() {
            $.ui.position.flip.top.apply( this, arguments );
            $.ui.position.fit.top.apply( this, arguments );
        }
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.position.js and 1 other location - About 1 hr to fix
resources/lib/jquery.ui/jquery.ui.position.js on lines 436..439

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

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

    _ctx.$slots.footer && _ctx.$slots.footer().length > 0 ? (openBlock(), createElementBlock("div", _hoisted_20, [
      renderSlot(_ctx.$slots, "footer")
    ])) : createCommentVNode("v-if", true)
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 1 hr to fix
resources/lib/codex/codex.js on lines 1247..1249

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

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

            createElementVNode(
              "div",
              {
                ref: "focusTrapEnd",
                tabindex: "0",
Severity: Major
Found in resources/lib/codex/codex.js and 1 other location - About 1 hr to fix
resources/lib/codex/codex.js on lines 5776..5786

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

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 ( error ) {
        compatOpening.reject( new OO.ui.Error( error ) );
        lifecycle.deferreds.opening.reject( new OO.ui.Error( error ) );
        return lifecycle;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-windows.js and 1 other location - About 1 hr to fix
resources/lib/ooui/oojs-ui-windows.js on lines 1516..1520

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

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.allspecifier !== undefined ) {
                            items.unshift( new OO.ui.MenuOptionWidget( {
                                data: pi.allspecifier,
                                label: mw.msg( 'apisandbox-multivalue-all-values', pi.allspecifier )
                            } ) );
Severity: Major
Found in resources/src/mediawiki.special.apisandbox/apisandbox.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.special.apisandbox/apisandbox.js on lines 394..399

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

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.allspecifier !== undefined ) {
                            items.unshift( new OO.ui.MenuOptionWidget( {
                                data: pi.allspecifier,
                                label: mw.msg( 'apisandbox-multivalue-all-namespaces', pi.allspecifier )
                            } ) );
Severity: Major
Found in resources/src/mediawiki.special.apisandbox/apisandbox.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.special.apisandbox/apisandbox.js on lines 468..473

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

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

Function cleanUpValue has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    mw.widgets.datetime.DateTimeInputWidget.prototype.cleanUpValue = function ( value ) {
        let date, pad;

        if ( value === '' ) {
            return '';
Severity: Minor
Found in resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js - About 1 hr to fix

    Function ForeignUpload has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function ForeignUpload( target, apiconfig ) {
            let api,
                validTargets = config.ForeignUploadTargets,
                upload = this;
    
    
    Severity: Minor
    Found in resources/src/mediawiki.ForeignUpload.js - About 1 hr to fix

      Function postWithToken has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              postWithToken: function ( tokenType, params, ajaxOptions ) {
                  const api = this,
                      assertParams = {
                          assert: params.assert,
                          assertuser: params.assertuser
      Severity: Minor
      Found in resources/src/mediawiki.api/index.js - About 1 hr to fix

        Function install has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            install: function ( app ) {
                /**
                 * Adds an `$i18n()` instance method that can be used in all components. This method is a
                 * proxy to {@link mw.message}.
                 *
        Severity: Minor
        Found in resources/src/vue/i18n.js - About 1 hr to fix

          Function onLoadData has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function onLoadData( pageData ) {
              if ( wasPosted ) {
                  // If this is a POST request, save the current data (e.g. from a preview).
                  saveFormData();
              }
          Severity: Minor
          Found in resources/src/mediawiki.editRecovery/edit.js - About 1 hr to fix

            Function MwWidgetsSearchInputWidget has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                mw.widgets.SearchInputWidget = function MwWidgetsSearchInputWidget( config ) {
                    // The parent constructors will detach this from the DOM, and won't
                    // be reattached until after this function is completed. As such
                    // grab a handle here. If no config.$input is passed tracking of
                    // form submissions won't work.
            Severity: Minor
            Found in resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js - About 1 hr to fix

              Function initialize has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              SavedQueriesModel.prototype.initialize = function ( savedQueries ) {
                  const model = this;
              
                  savedQueries = savedQueries || {};
              
              
              Severity: Minor
              Found in resources/src/mediawiki.rcfilters/dm/SavedQueriesModel.js - About 1 hr to fix

                Function handleCharacterNavigation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function handleCharacterNavigation(e) {
                      if (e.key === "Clear") {
                        clearKeyBuffer();
                        return true;
                      }
                Severity: Minor
                Found in resources/lib/codex/codex.js - About 1 hr to fix

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

                  function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
                    const _component_cdx_icon = resolveComponent("cdx-icon");
                    const _component_cdx_button = resolveComponent("cdx-button");
                    return openBlock(), createBlock(Transition, {
                      name: "cdx-message",
                  Severity: Minor
                  Found in resources/lib/codex/codex.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language