wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    protected function getSourceSection() {
        if ( $this->mSessionKey ) {
            return [
                'SessionKey' => [
                    'type' => 'hidden',
Severity: Major
Found in includes/specials/forms/UploadForm.php - About 2 hrs to fix

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

        private static function getDefaults() {
            $services = MediaWikiServices::getInstance();
            $mainConfig = $services->getMainConfig();
            $interwikiMagic = $mainConfig->get( MainConfigNames::InterwikiMagic );
            $allowExternalImages = $mainConfig->get( MainConfigNames::AllowExternalImages );
    Severity: Major
    Found in includes/parser/ParserOptions.php - About 2 hrs to fix

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

          public function load( $flags = IDBAccessObject::READ_NORMAL ) {
              global $wgFullyInitialised;
      
              if ( $this->mLoadedItems === true ) {
                  return;
      Severity: Major
      Found in includes/user/User.php - About 2 hrs to fix

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

            public function publishBatch( array $ntuples, $flags = 0 ) {
                $this->assertWritableRepo(); // fail out if read-only
        
                $backend = $this->backend; // convenience
                // Try creating directories
        Severity: Major
        Found in includes/filerepo/FileRepo.php - About 2 hrs to fix

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

              public function getResponseBodySchema() {
                  // TODO: we need to reference a re-usable "user" type. The license structure should also be re-usable.
                  return [
                      'description' => 'revision meta-data',
                      'required' => [
          Severity: Major
          Found in includes/Rest/Handler/Helper/RevisionContentHelper.php - About 2 hrs to fix

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

                public function __construct( LanguageFactory $languageFactory ) {
                    parent::__construct(
                        $languageFactory,
                        [
                            'А',
            Severity: Major
            Found in includes/collation/AbkhazUppercaseCollation.php - About 2 hrs to fix

              File mw.widgets.MediaSearchWidget.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*!
               * MediaWiki Widgets - MediaSearchWidget class.
               *
               * @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
               * @license The MIT License (MIT); see LICENSE.txt

                File ClientHtml.php has 286 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/ResourceLoader/ClientHtml.php - About 2 hrs to fix

                  File MWLBFactory.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * Generator of database load balancing objects.
                   *
                   * This program is free software; you can redistribute it and/or modify
                  Severity: Minor
                  Found in includes/db/MWLBFactory.php - About 2 hrs to fix

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            $.extend(this.offset, {
                                click: { //Where the click happened, relative to the element
                                    left: event.pageX - this.offset.left,
                                    top: event.pageY - this.offset.top
                                },
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.sortable.js and 1 other location - About 2 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.draggable.js on lines 126..133

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

                    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

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            $.extend(this.offset, {
                                click: { //Where the click happened, relative to the element
                                    left: event.pageX - this.offset.left,
                                    top: event.pageY - this.offset.top
                                },
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.draggable.js and 1 other location - About 2 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.sortable.js on lines 158..165

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

                    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

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            ordinal: function (number, period) {
                                var output =
                                    number === 1
                                        ? 'r'
                                        : number === 2
                    Severity: Major
                    Found in resources/lib/moment/locale/oc-lnc.js and 1 other location - About 2 hrs to fix
                    resources/lib/moment/locale/ca.js on lines 84..99

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

                    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

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            ordinal: function (number, period) {
                                var output =
                                    number === 1
                                        ? 'r'
                                        : number === 2
                    Severity: Major
                    Found in resources/lib/moment/locale/ca.js and 1 other location - About 2 hrs to fix
                    resources/lib/moment/locale/oc-lnc.js on lines 70..85

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

                    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 ( extDependencyMap[ name ].skins ) {
                                    for ( i in extDependencyMap[ name ].skins ) {
                                        skin = extDependencyMap[ name ].skins[ i ];
                                        node = document.getElementById( 'config_skin-' + skin );
                                        if ( !node || !node.checked ) {
                    Severity: Major
                    Found in mw-config/config.js and 1 other location - About 2 hrs to fix
                    mw-config/config.js on lines 110..118

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

                    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 ( extDependencyMap[ name ].extensions ) {
                                    for ( i in extDependencyMap[ name ].extensions ) {
                                        ext = extDependencyMap[ name ].extensions[ i ];
                                        node = document.getElementById( 'config_ext-' + ext );
                                        if ( !node || !node.checked ) {
                    Severity: Major
                    Found in mw-config/config.js and 1 other location - About 2 hrs to fix
                    mw-config/config.js on lines 119..127

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

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

                        function explodeRowspans( $table ) {
                            let spanningRealCellIndex, colSpan,
                                rowspanCells = $table.find( '> tbody > tr > [rowspan]' ).get();
                    
                            // Short circuit
                    Severity: Major
                    Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 hrs to fix

                      Function ExpiryWidget has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          mw.widgets.ExpiryWidget = function ( config ) {
                              const RFC2822 = 'ddd, DD MMM YYYY HH:mm:ss [GMT]';
                      
                              // Config initialization
                              config = Object.assign( {}, config );
                      Severity: Major
                      Found in resources/src/mediawiki.widgets/mw.widgets.ExpiryInputWidget.js - About 2 hrs to fix

                        Function getErrorMessageForStateDetails has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            mw.Upload.BookletLayout.prototype.getErrorMessageForStateDetails = function () {
                                let state = this.upload.getState(),
                                    stateDetails = this.upload.getStateDetails(),
                                    warnings = stateDetails.upload && stateDetails.upload.warnings,
                                    $ul = $( '<ul>' ),
                        Severity: Major
                        Found in resources/src/mediawiki.Upload.BookletLayout/BookletLayout.js - About 2 hrs to fix

                          File mw.widgets.TableWidget.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /**
                           * @classdesc Groups {@link mw.widgets.RowWidget row widgets} together to form a bidimensional
                           * grid of text inputs.
                           *
                           * @class
                          Severity: Minor
                          Found in resources/src/mediawiki.widgets/Table/mw.widgets.TableWidget.js - About 2 hrs to fix

                            Function diffCleanupSemantic has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                DiffMatchPatch.prototype.diffCleanupSemantic = function (diffs) {
                                  var changes = false;
                                  var equalities = []; // Stack of indices where equalities are found.
                                  var equalitiesLength = 0; // Keeping our own length var is faster in JS.
                                  /** @type {?string} */
                            Severity: Major
                            Found in resources/lib/qunitjs/qunit.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language