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 ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
        c2 = str.charCodeAt(m_pos + 1);
        if ((c2 & 0xfc00) === 0xdc00) {
          c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
          m_pos++;
Severity: Major
Found in resources/lib/pako/pako_deflate.js and 1 other location - About 2 hrs to fix
resources/lib/pako/pako_deflate.js on lines 3561..3567

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

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 (hoset + that.size.height >= that.parentData.height) {
            that.size.height = that.parentData.height - hoset;
            if (pRatio) that.size.width = that.size.height * that.aspectRatio;
        }
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 708..711

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

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

          getPrepared: function getPrepared(target) {
            if (target.length > 999) return fuzzysort.prepare(target); // don't cache huge targets
            var targetPrepared = preparedCache.get(target);
            if (targetPrepared !== undefined) return targetPrepared;
            targetPrepared = fuzzysort.prepare(target);
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 4772..4779

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

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

          getPreparedSearch: function getPreparedSearch(search) {
            if (search.length > 999) return fuzzysort.prepareSearch(search); // don't cache huge searches
            var searchPrepared = preparedSearchCache.get(search);
            if (searchPrepared !== undefined) return searchPrepared;
            searchPrepared = fuzzysort.prepareSearch(search);
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 4764..4771

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

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

FilterMenuHeaderWidget.prototype.updateInvertNamespacesButton = function () {
    this.invertNamespacesButton.setActive( this.invertNamespacesModel.isSelected() );
    this.invertNamespacesButton.setLabel(
        this.invertNamespacesModel.isSelected() ?
            mw.msg( 'rcfilters-exclude-button-on' ) :
resources/src/mediawiki.rcfilters/ui/FilterMenuHeaderWidget.js on lines 171..178

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

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 (woset + that.size.width >= that.parentData.width) {
            that.size.width = that.parentData.width - woset;
            if (pRatio) that.size.height = that.size.width / that.aspectRatio;
        }
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 713..716

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

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

FilterMenuHeaderWidget.prototype.updateInvertTagsButton = function () {
    this.invertTagsButton.setActive( this.invertTagsModel.isSelected() );
    this.invertTagsButton.setLabel(
        this.invertTagsModel.isSelected() ?
            mw.msg( 'rcfilters-exclude-button-on' ) :
resources/src/mediawiki.rcfilters/ui/FilterMenuHeaderWidget.js on lines 183..190

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

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 NewPagesPager.php has 287 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/specials/pagers/NewPagesPager.php - About 2 hrs to fix

    File MessagesNn.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /** Norwegian Nynorsk (norsk nynorsk)
     *
     * @file
     * @ingroup Languages
    Severity: Minor
    Found in languages/messages/MessagesNn.php - About 2 hrs to fix

      Function add has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          add: function( elem, types, handler, data, selector ) {
      
              var handleObjIn, eventHandle, tmp,
                  events, t, handleObj,
                  special, handlers, type, namespaces, origType,
      Severity: Major
      Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

        Function matcherFromGroupMatchers has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
            var bySet = setMatchers.length > 0,
                byElement = elementMatchers.length > 0,
                superMatcher = function( seed, context, xml, results, outermost ) {
                    var elem, j, matcher,
        Severity: Major
        Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

          Function done has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function done( status, nativeStatusText, responses, headers ) {
                      var isSuccess, success, error, response, modified,
                          statusText = nativeStatusText;
          
                      // Ignore repeat invocations
          Severity: Major
          Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

            Function _create has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _create: function() {
                    this.activeMenu = this.element;
                    this.element
                        .uniqueId()
                        .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
            Severity: Major
            Found in resources/lib/jquery.ui/jquery.ui.menu.js - About 2 hrs to fix

              Method release has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function release() {
                      if ( $this->slot === null ) {
                          return Status::newGood( PoolCounter::NOT_LOCKED ); // not locked
                      }
              
              
              Severity: Major
              Found in includes/poolcounter/PoolCounterRedis.php - About 2 hrs to fix

                Method import has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function import( ImportableUploadRevision $importableRevision ) {
                        # Construct a file
                        $archiveName = $importableRevision->getArchiveName();
                        $localRepo = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo();
                        if ( $archiveName ) {
                Severity: Major
                Found in includes/import/ImportableUploadRevisionImporter.php - About 2 hrs to fix

                  Method getSlotRowsForBatch has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getSlotRowsForBatch(
                          $rowsOrIds,
                          array $options = [],
                          $queryFlags = 0
                      ) {
                  Severity: Major
                  Found in includes/Revision/RevisionStore.php - About 2 hrs to fix

                    Method addToSidebarPlain has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function addToSidebarPlain( &$bar, $text ) {
                            $lines = explode( "\n", $text );
                    
                            $heading = '';
                            $config = $this->getConfig();
                    Severity: Major
                    Found in includes/skins/Skin.php - About 2 hrs to fix

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

                          public function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
                              $djvuRenderer = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::DjvuRenderer );
                              $djvuPostProcessor = MediaWikiServices::getInstance()->getMainConfig()
                                  ->get( MainConfigNames::DjvuPostProcessor );
                              if ( !$this->normaliseParams( $image, $params ) ) {
                      Severity: Major
                      Found in includes/media/DjVuHandler.php - About 2 hrs to fix

                        Method processIndividual has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function processIndividual( $type, $params, $id ) {
                                $user = $this->getUser();
                                $idResult = [ $type => $id ];
                        
                                // validate the ID
                        Severity: Major
                        Found in includes/api/ApiTag.php - About 2 hrs to fix

                          Method getAllowedParams has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getAllowedParams() {
                                  $ret = [
                                      'sort' => [
                                          ParamValidator::PARAM_DEFAULT => 'name',
                                          ParamValidator::PARAM_TYPE => [
                          Severity: Major
                          Found in includes/api/ApiQueryAllImages.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language