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.mixin.ClippableElement.prototype.getHorizontalAnchorEdge = function () {
    if ( this.computePosition && this.positioning && this.computePosition().right !== '' ) {
        return 'right';
    }
    return 'left';
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
resources/lib/ooui/oojs-ui-core.js on lines 5657..5662

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

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.mixin.ClippableElement.prototype.getVerticalAnchorEdge = function () {
    if ( this.computePosition && this.positioning && this.computePosition().bottom !== '' ) {
        return 'bottom';
    }
    return 'top';
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
resources/lib/ooui/oojs-ui-core.js on lines 5635..5640

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

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

    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
        var month = config._locale.monthsParse(input, token, config._strict);
        // if we didn't find a month name, mark the date as invalid.
        if (month != null) {
            array[MONTH] = month;
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 1484..1492

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

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

          for (var a = e - 1 >> 1; e > 0 && n.score < r[a].score; a = (e = a) - 1 >> 1) {
            r[e] = r[a];
          }
Severity: Major
Found in resources/lib/qunitjs/qunit.js and 1 other location - About 2 hrs to fix
resources/lib/qunitjs/qunit.js on lines 5110..5112

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

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.NumberInputWidget.prototype.setDisabled = function ( disabled ) {
    // Parent method
    OO.ui.NumberInputWidget.super.prototype.setDisabled.call( this, disabled );
    this.updateControlsDisabled();
    return this;
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
resources/lib/ooui/oojs-ui-core.js on lines 8721..8728

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

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

    function keypress( e, context, key ) {
        // eslint-disable-next-line no-jquery/no-sizzle
        let wasVisible = context.data.$container.is( ':visible' ),
            preventDefault = false;

Severity: Major
Found in resources/src/jquery/jquery.suggestions.js - About 2 hrs to fix

    Function update has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function update( context, delayed ) {
            function maybeFetch() {
                if ( typeof context.config.update.before === 'function' ) {
                    context.config.update.before.call( context.data.$textbox );
                }
    Severity: Major
    Found in resources/src/jquery/jquery.suggestions.js - About 2 hrs to fix

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

          function makeApi(sinon) {
              sinon.Event = function Event(type, bubbles, cancelable, target) {
                  this.initEvent(type, bubbles, cancelable, target);
              };
      
      
      Severity: Major
      Found in resources/lib/sinonjs/sinon.js - About 2 hrs to fix

        Function OoUiPopupToolGroup has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        OO.ui.PopupToolGroup = function OoUiPopupToolGroup( toolbar, config ) {
            // Allow passing positional parameters inside the config object
            if ( OO.isPlainObject( toolbar ) && config === undefined ) {
                config = toolbar;
                toolbar = config.toolbar;
        Severity: Major
        Found in resources/lib/ooui/oojs-ui-toolbars.js - About 2 hrs to fix

          Function createWrapper has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              createWrapper: function( element ) {
          
                  // if the element is already wrapped, return it
                  if ( element.parent().is( ".ui-effects-wrapper" )) {
                      return element.parent();
          Severity: Major
          Found in resources/lib/jquery.ui/jquery.ui.effect.js - About 2 hrs to fix

            Function _mouseDrag has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _mouseDrag: function(event) {
            
                    //Compute the helpers position
                    this.position = this._generatePosition(event);
                    this.positionAbs = this._convertPositionTo("absolute");
            Severity: Major
            Found in resources/lib/jquery.ui/jquery.ui.sortable.js - About 2 hrs to fix

              Function _hotUpdate has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        store._hotUpdate = vueDemi.markRaw((newStore) => {
                            store._hotUpdating = true;
                            newStore._hmrPayload.state.forEach((stateKey) => {
                                if (stateKey in store.$state) {
                                    const newStateTarget = newStore.$state[stateKey];
              Severity: Major
              Found in resources/lib/pinia/pinia.iife.js - About 2 hrs to fix

                Method getHeadHtml has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getHeadHtml( $nojsClass = null ) {
                        $script = $this->getDocumentClassNameScript( $nojsClass );
                
                        // Inline script: Declare mw.config variables for this page.
                        if ( $this->config ) {
                Severity: Major
                Found in includes/ResourceLoader/ClientHtml.php - About 2 hrs to fix

                  Method getHtml has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getHtml(): string {
                          if ( !isset( $this->page ) ) {
                              throw new RuntimeException( 'page must be set' );
                          }
                          if ( isset( $this->firstMsg ) !== isset( $this->lastMsg ) ) {
                  Severity: Major
                  Found in includes/Navigation/PagerNavigationBuilder.php - About 2 hrs to fix

                    Method doGetLocalCopyMulti has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function doGetLocalCopyMulti( array $params ) {
                            $ep = array_diff_key( $params, [ 'srcs' => 1 ] ); // for error logging
                            // Blindly create tmp files and stream to them, catching any exception
                            // if the file does not exist. Do not waste time doing file stats here.
                            $reqs = []; // (path => op)
                    Severity: Major
                    Found in includes/libs/filebackend/SwiftFileBackend.php - About 2 hrs to fix

                      Method modifyDisplayQuery has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function modifyDisplayQuery( &$tables, &$fields, &$conds,
                              &$join_conds, &$options, $filter_tag = '', bool $exclude = false
                          ) {
                              $useTagFilter = $this->options->get( MainConfigNames::UseTagFilter );
                      
                      
                      Severity: Major
                      Found in includes/changetags/ChangeTagsStore.php - About 2 hrs to fix

                        Method getResetKinds has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getResetKinds(
                                User $user, IContextSource $context, $options = null
                            ): array {
                                $options ??= $this->userOptionsManager->loadUserOptions( $user );
                        
                        
                        Severity: Major
                        Found in includes/preferences/DefaultPreferencesFactory.php - About 2 hrs to fix

                          Method transformDOM has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function transformDOM(
                                  Document $dom, ParserOutput $po, ?ParserOptions $popts, array &$options
                              ): Document {
                                  $skin = $this->resolveSkin( $options );
                                  $titleText = $po->getTitleText();
                          Severity: Major
                          Found in includes/OutputTransform/Stages/HandleParsoidSectionLinks.php - About 2 hrs to fix

                            Method extractTitle has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected static function extractTitle( $path, $pattern ) {
                                    // Convert the path pattern into a regexp we can match with
                                    $regexp = preg_quote( $pattern->path, '#' );
                                    // .* for the $1
                                    $regexp = preg_replace( '#\\\\\$1#u', '(?P<par1>.*)', $regexp );
                            Severity: Major
                            Found in includes/Request/PathRouter.php - About 2 hrs to fix

                              Method execute has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function execute() {
                                      // Check whether upload is enabled
                                      if ( !UploadBase::isEnabled() ) {
                                          $this->dieWithError( 'uploaddisabled' );
                                      }
                              Severity: Major
                              Found in includes/api/ApiUpload.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language