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

OO.ui.OptionWidget.prototype.isPressable = function () {
    return this.constructor.static.pressable && !this.disabled && this.isVisible();
};
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 1 hr to fix
resources/lib/ooui/oojs-ui-core.js on lines 6962..6964

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

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

OO.ui.PageLayout.prototype.setOutlineItem = function ( outlineItem ) {
    this.outlineItem = outlineItem || null;
    if ( outlineItem ) {
        this.setupOutlineItem();
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-widgets.js and 1 other location - About 1 hr to fix
resources/lib/ooui/oojs-ui-widgets.js on lines 1118..1124

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

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

OO.ui.TabPanelLayout.prototype.setTabItem = function ( tabItem ) {
    this.tabItem = tabItem || null;
    if ( tabItem ) {
        this.setupTabItem();
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-widgets.js and 1 other location - About 1 hr to fix
resources/lib/ooui/oojs-ui-widgets.js on lines 1269..1275

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

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

OO.ui.MultilineTextInputWidget.prototype.onElementAttach = function () {
    OO.ui.MultilineTextInputWidget.super.prototype.onElementAttach.call( this );
    this.adjustSize();
};
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 1 hr to fix
resources/lib/ooui/oojs-ui-core.js on lines 12296..12299

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

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 getCalendarData has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    mw.widgets.datetime.ProlepticGregorianDateTimeFormatter.prototype.getCalendarData = function ( date ) {
        const getDate = this.local ? 'getDate' : 'getUTCDate',
            setDate = this.local ? 'setDate' : 'setUTCDate';

        const ret = {

    Function getComponentsFromDate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        mw.widgets.datetime.DiscordianDateTimeFormatter.prototype.getComponentsFromDate = function ( date ) {
            let ret, day, month;
    
            const monthDays = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ];
    
    

      Function uploadWithFormData has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              uploadWithFormData: function ( file, data ) {
                  const deferred = $.Deferred();
      
                  for ( const key in data ) {
                      if ( !fieldsAllowed[ key ] ) {
      Severity: Minor
      Found in resources/src/mediawiki.api/upload.js - About 1 hr to fix

        Function showCurrentImage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mw.GallerySlideshow.prototype.showCurrentImage = function ( init ) {
                let $thumbnail, $imgLink,
                    $imageLi = this.getCurrentImage(),
                    $caption = $imageLi.find( '.gallerytext' );
        
        
        Severity: Minor
        Found in resources/src/mediawiki.page.gallery.slideshow.js - About 1 hr to fix

          Function MwRcfiltersUiTagItemWidget has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const TagItemWidget = function MwRcfiltersUiTagItemWidget(
              controller, filtersViewModel, invertModel, itemModel, config
          ) {
              // Configuration initialization
              config = config || {};
          Severity: Minor
          Found in resources/src/mediawiki.rcfilters/ui/TagItemWidget.js - About 1 hr to fix

            Function start has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Notification.prototype.start = function () {
                    let options, $notification, $tagMatches, autohideCount;
            
                    $area.css( 'display', '' );
            
            
            Severity: Minor
            Found in resources/src/mediawiki.notification/notification.js - About 1 hr to fix

              Function getAccessKeyModifiers has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getAccessKeyModifiers( nav ) {
                  if ( !nav && cachedModifiers ) {
                      return cachedModifiers;
                  }
              
              
              Severity: Minor
              Found in resources/src/mediawiki.util/jquery.accessKeyLabel.js - About 1 hr to fix

                Function initTempUserBannerTooltip has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function initTempUserBannerTooltip( $bannerEl, $tooltipEl, $buttonEl ) {
                        if ( !$bannerEl.length || !$tooltipEl.length || !$buttonEl.length ) {
                            return;
                        }
                
                
                Severity: Minor
                Found in resources/src/mediawiki.tempUserBanner/tempUserBanner.js - About 1 hr to fix

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

                  function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
                    const _component_cdx_icon = resolveComponent("cdx-icon");
                    const _component_cdx_button = resolveComponent("cdx-button");
                    return openBlock(), createElementBlock(
                      "div",
                  Severity: Minor
                  Found in resources/lib/codex/codex.js - About 1 hr to fix

                    Function makeApi has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function makeApi(sinon) {
                            function valueFormatter(value) {
                                return "" + value;
                            }
                    
                    
                    Severity: Minor
                    Found in resources/lib/sinonjs/sinon.js - About 1 hr to fix

                      Function style has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          style: function( elem, name, value, extra ) {
                      
                              // Don't set styles on text and comment nodes
                              if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
                                  return;
                      Severity: Minor
                      Found in resources/lib/jquery/jquery.js - About 1 hr to fix

                        Function copyConfig has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function copyConfig(to, from) {
                                var i, prop, val;
                        
                                if (!isUndefined(from._isAMomentObject)) {
                                    to._isAMomentObject = from._isAMomentObject;
                        Severity: Minor
                        Found in resources/lib/moment/moment.js - About 1 hr to fix

                          Function stop has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              stop: function( type, clearQueue, gotoEnd ) {
                                  var stopQueue = function( hooks ) {
                                      var stop = hooks.stop;
                                      delete hooks.stop;
                                      stop( gotoEnd );
                          Severity: Minor
                          Found in resources/lib/jquery/jquery.js - About 1 hr to fix

                            Function access has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
                                var i = 0,
                                    len = elems.length,
                                    bulk = key == null;
                            
                            
                            Severity: Minor
                            Found in resources/lib/jquery/jquery.js - About 1 hr to fix

                              Function adjustCSS has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function adjustCSS( elem, prop, valueParts, tween ) {
                                  var adjusted, scale,
                                      maxIterations = 20,
                                      currentValue = tween ?
                                          function() {
                              Severity: Minor
                              Found in resources/lib/jquery/jquery.js - About 1 hr to fix

                                Function dispatch has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    dispatch: function( nativeEvent ) {
                                
                                        var i, j, ret, matched, handleObj, handlerQueue,
                                            args = new Array( arguments.length ),
                                
                                
                                Severity: Minor
                                Found in resources/lib/jquery/jquery.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language