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

    mw.widgets.TitlesMultiselectWidget.prototype.onTagSelect = function () {
        if ( this.hasInput && !this.input.getValue() ) {
            OO.ui.TagMultiselectWidget.prototype.onTagSelect.apply( this, arguments );
        }
    };
resources/src/mediawiki.widgets/mw.widgets.UsersMultiselectWidget.js on lines 227..231

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

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

    public static function newFromKey( $sha1, $repo, $timestamp = false ) {
        $dbr = $repo->getReplicaDB();
        $queryBuilder = FileSelectQueryBuilder::newForOldFile( $dbr );

        $queryBuilder->where( [ 'oi_sha1' => $sha1 ] );
Severity: Major
Found in includes/filerepo/file/OldLocalFile.php and 1 other location - About 2 hrs to fix
includes/filerepo/file/LocalFile.php on lines 243..259

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

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

        'messages' => [
            'timezone-utc',
            'timezone-local',
            'january',
            'february',
Severity: Major
Found in resources/Resources.php and 1 other location - About 2 hrs to fix
includes/collation/BashkirUppercaseCollation.php on lines 33..76

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

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

    public static function newFromKey( $sha1, $repo, $timestamp = false ) {
        $dbr = $repo->getReplicaDB();
        $queryBuilder = FileSelectQueryBuilder::newForFile( $dbr );

        $queryBuilder->where( [ 'img_sha1' => $sha1 ] );
Severity: Major
Found in includes/filerepo/file/LocalFile.php and 1 other location - About 2 hrs to fix
includes/filerepo/file/OldLocalFile.php on lines 102..117

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

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

    public function setUnidirectionalConflict( $other, $globalDescription, $contextDescription ) {
        if ( $other instanceof ChangesListFilterGroup ) {
            $this->conflictingGroups[] = [
                'group' => $other->getName(),
                'groupObject' => $other,
Severity: Major
Found in includes/recentchanges/ChangesListFilter.php and 1 other location - About 2 hrs to fix
includes/recentchanges/ChangesListFilterGroup.php on lines 255..276

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

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

    public function setUnidirectionalConflict( $other, $globalDescription, $contextDescription ) {
        if ( $other instanceof ChangesListFilterGroup ) {
            $this->conflictingGroups[] = [
                'group' => $other->getName(),
                'groupObject' => $other,
Severity: Major
Found in includes/recentchanges/ChangesListFilterGroup.php and 1 other location - About 2 hrs to fix
includes/recentchanges/ChangesListFilter.php on lines 222..243

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

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

            [
                'А',
                'Б',
                'В',
                'Г',
Severity: Major
Found in includes/collation/BashkirUppercaseCollation.php and 1 other location - About 2 hrs to fix
resources/Resources.php on lines 2919..2962

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

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 Image.php has 266 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/Image.php - About 2 hrs to fix

    File ActionFactory.php has 266 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/actions/ActionFactory.php - About 2 hrs to fix

      File ApiQueryAllRevisions.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Copyright © 2015 Wikimedia Foundation and contributors
       *
       * This program is free software; you can redistribute it and/or modify
      Severity: Minor
      Found in includes/api/ApiQueryAllRevisions.php - About 2 hrs to fix

        Function MwRcfiltersUiRcTopSectionWidget has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const RcTopSectionWidget = function MwRcfiltersUiRcTopSectionWidget(
            savedLinksListWidget, $topLinks, config
        ) {
            const topLinksCookieName = 'rcfilters-toplinks-collapsed-state',
                topLinksCookie = mw.cookie.get( topLinksCookieName ),
        Severity: Major
        Found in resources/src/mediawiki.rcfilters/ui/RcTopSectionWidget.js - About 2 hrs to fix

          Function Notification has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Notification( message, options ) {
                  let $notification, $notificationContent;
          
                  $notification = $( '<div>' )
                      .data( 'mw-notification', this )
          Severity: Major
          Found in resources/src/mediawiki.notification/notification.js - About 2 hrs to fix

            Function updateMenuItems has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                mw.widgets.UsersMultiselectWidget.prototype.updateMenuItems = function () {
                    const inputValue = this.input.getValue();
            
                    if ( inputValue === this.inputValue ) {
                        // Do not restart api query if nothing has changed in the input
            Severity: Major
            Found in resources/src/mediawiki.widgets/mw.widgets.UsersMultiselectWidget.js - About 2 hrs to fix

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

              function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
                const _component_cdx_label = resolveComponent("cdx-label");
                return openBlock(), createElementBlock(
                  "div",
                  {
              Severity: Major
              Found in resources/lib/codex/codex.js - About 2 hrs to fix

                Function translate has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function translate(number, withoutSuffix, key) {
                        var result = number + ' ';
                        switch (key) {
                            case 'ss':
                                if (number === 1) {
                Severity: Major
                Found in resources/lib/moment/locale/bs.js - About 2 hrs to fix

                  Function translate has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function translate(number, withoutSuffix, key) {
                          var result = number + ' ';
                          switch (key) {
                              case 'ss':
                                  if (number === 1) {
                  Severity: Major
                  Found in resources/lib/moment/locale/hr.js - About 2 hrs to fix

                    Function ajaxConvert has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function ajaxConvert( s, response, jqXHR, isSuccess ) {
                        var conv2, current, conv, tmp, prev,
                            converters = {},
                    
                            // Work with a copy of dataTypes in case we need to modify it for conversion
                    Severity: Major
                    Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

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

                          public function __construct(
                              SessionId $id, SessionInfo $info, CachedBagOStuff $store, LoggerInterface $logger,
                              HookContainer $hookContainer, $lifetime
                          ) {
                              $phpSessionHandling = MediaWikiServices::getInstance()->getMainConfig()
                      Severity: Major
                      Found in includes/session/SessionBackend.php - About 2 hrs to fix

                        Method setHeaders has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function setHeaders() {
                                $out = $this->context->getOutput();
                        
                                $out->addModules( 'mediawiki.action.edit' );
                                $out->addModuleStyles( 'mediawiki.action.edit.styles' );
                        Severity: Major
                        Found in includes/editpage/EditPage.php - About 2 hrs to fix

                          Method send has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function send( $to, $from, $subject, $body, $options = [] ) {
                                  $services = MediaWikiServices::getInstance();
                                  $allowHTMLEmail = $services->getMainConfig()->get(
                                      MainConfigNames::AllowHTMLEmail );
                          
                          
                          Severity: Major
                          Found in includes/mail/UserMailer.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language