wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

File BotPassword.php has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Utility class for bot passwords
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Minor
Found in includes/user/BotPassword.php - About 2 hrs to fix

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

                new OO.ui.ButtonWidget( {
                    framed: !!this.isMobile,
                    data: 'namespaces',
                    icon: 'article',
                    label: mw.msg( 'namespaces' ),
    resources/src/mediawiki.rcfilters/ui/FilterTagMultiselectWidget.js on lines 270..277

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

    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

                new OO.ui.ButtonWidget( {
                    framed: !!this.isMobile,
                    data: 'tags',
                    icon: 'tag',
                    label: mw.msg( 'tags-title' ),
    resources/src/mediawiki.rcfilters/ui/FilterTagMultiselectWidget.js on lines 262..269

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

    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

        ForeignUpload.prototype.uploadToStash = function () {
            const upload = this;
            return this.apiPromise.then( ( api ) => {
                upload.api = api;
                return mw.Upload.prototype.uploadToStash.call( upload );
    Severity: Major
    Found in resources/src/mediawiki.ForeignUpload.js and 1 other location - About 2 hrs to fix
    resources/src/mediawiki.ForeignUpload.js on lines 127..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 81.

    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 ( position.left < padding.left ) {
                animations.scrollLeft = containerDimensions.scroll.left + position.left - padding.left;
            } else if ( position.right < padding.right ) {
                animations.scrollLeft = containerDimensions.scroll.left +
                    // Scroll the right into view, but not at the expense
    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 1400..1407

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

    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

        ForeignUpload.prototype.upload = function () {
            const upload = this;
            return this.apiPromise.then( ( api ) => {
                upload.api = api;
                return mw.Upload.prototype.upload.call( upload );
    Severity: Major
    Found in resources/src/mediawiki.ForeignUpload.js and 1 other location - About 2 hrs to fix
    resources/src/mediawiki.ForeignUpload.js on lines 140..146

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

    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 ( position.top < padding.top || config.alignToTop ) {
                animations.scrollTop = containerDimensions.scroll.top + position.top - padding.top;
            } else if ( position.bottom < padding.bottom ) {
                animations.scrollTop = containerDimensions.scroll.top +
                    // Scroll the bottom into view, but not at the expense
    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 1410..1417

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

    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.BookletLayout.prototype.selectFirstSelectablePage = function () {
        if ( !this.outlineSelectWidget.findSelectedItem() ) {
            this.outlineSelectWidget.selectItem( this.outlineSelectWidget.findFirstSelectableItem() );
        }
    
    
    Severity: Major
    Found in resources/lib/ooui/oojs-ui-widgets.js and 1 other location - About 2 hrs to fix
    resources/lib/ooui/oojs-ui-widgets.js on lines 2975..2981

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

    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.IndexLayout.prototype.selectFirstSelectableTabPanel = function () {
        if ( !this.tabSelectWidget.findSelectedItem() ) {
            this.tabSelectWidget.selectItem( this.tabSelectWidget.findFirstSelectableItem() );
        }
    
    
    Severity: Major
    Found in resources/lib/ooui/oojs-ui-widgets.js and 1 other location - About 2 hrs to fix
    resources/lib/ooui/oojs-ui-widgets.js on lines 2457..2463

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

    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

            foreach ( $iterator as $file ) {
                if ( wfTimestamp( TS_UNIX, $tempRepo->getFileTimestamp( "$dir/$file" ) ) < $cutoff ) {
                    $batch[] = [ 'op' => 'delete', 'src' => "$dir/$file" ];
                    if ( count( $batch ) >= $this->getBatchSize() ) {
                        $this->doOperations( $tempRepo, $batch );
    Severity: Major
    Found in maintenance/cleanupUploadStash.php and 1 other location - About 2 hrs to fix
    maintenance/cleanupUploadStash.php on lines 108..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 127.

    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 where( $conds ) {
            if ( is_array( $conds ) ) {
                foreach ( $conds as $key => $cond ) {
                    if ( is_int( $key ) ) {
                        $this->conds[] = $cond;
    Severity: Major
    Found in includes/libs/rdbms/querybuilder/UpdateQueryBuilder.php and 1 other location - About 2 hrs to fix
    includes/libs/rdbms/querybuilder/SelectQueryBuilder.php on lines 325..343

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

    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 where( $conds ) {
            if ( is_array( $conds ) ) {
                foreach ( $conds as $key => $cond ) {
                    if ( is_int( $key ) ) {
                        $this->conds[] = $cond;
    Severity: Major
    Found in includes/libs/rdbms/querybuilder/SelectQueryBuilder.php and 1 other location - About 2 hrs to fix
    includes/libs/rdbms/querybuilder/UpdateQueryBuilder.php on lines 204..222

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

    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

            foreach ( $iterator as $file ) {
                if ( wfTimestamp( TS_UNIX, $tempRepo->getFileTimestamp( "$dir/$file" ) ) < $cutoff ) {
                    $batch[] = [ 'op' => 'delete', 'src' => "$dir/$file" ];
                    if ( count( $batch ) >= $this->getBatchSize() ) {
                        $this->doOperations( $tempRepo, $batch );
    Severity: Major
    Found in maintenance/cleanupUploadStash.php and 1 other location - About 2 hrs to fix
    maintenance/cleanupUploadStash.php on lines 138..148

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

    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

        private const SUFFIX_MAPPING = [
            # originally C2L
            'иаль' => 'ial', 'нуль' => 'nul', 'кой' => 'köy', 'койнинъ' => 'köyniñ', 'койни' => 'köyni',
            'койге' => 'köyge', 'койде' => 'köyde', 'койдеки' => 'köydeki', 'койден' => 'köyden',
            'козь' => 'köz', '-юнджи' => '-ünci', '-юнджиде' => '-üncide', '-юнджиден' => '-ünciden',
    Severity: Major
    Found in includes/languages/data/CrhExceptions.php and 1 other location - About 2 hrs to fix
    languages/messages/MessagesLv.php on lines 111..141

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

    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

    $dateFormats = [
        'ydm time' => 'H.i',
        'ydm date' => 'Y". gada" j. F',
        'ydm monthonly' => 'Y". gada" F',
        'ydm both' => 'Y". gada" j. F", plkst." H.i',
    Severity: Major
    Found in languages/messages/MessagesLv.php and 1 other location - About 2 hrs to fix
    includes/languages/data/CrhExceptions.php on lines 372..382

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

    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 notification.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    ( function () {
        'use strict';
    
        let notification,
            // The .mw-notification-area div that all notifications are contained inside.
    Severity: Minor
    Found in resources/src/mediawiki.notification/notification.js - About 2 hrs to fix

      File MessagesHr.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /** Croatian (hrvatski)
       *
       * @file
       * @ingroup Languages
      Severity: Minor
      Found in languages/messages/MessagesHr.php - About 2 hrs to fix

        File MessagesPt.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /** Portuguese (português)
         *
         * @file
         * @ingroup Languages
        Severity: Minor
        Found in languages/messages/MessagesPt.php - About 2 hrs to fix

          File importDump.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Import XML dump files into the current wiki.
           *
           * Copyright © 2005 Brooke Vibber <bvibber@wikimedia.org>
          Severity: Minor
          Found in maintenance/importDump.php - About 2 hrs to fix

            Function JpegFile has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                JpegMeta.JpegFile = function JpegFile(binary_data, filename) {
                    /* Change this to EOI if we want to parse. */
                    var break_segment = this._SOS;
                    
                    this.metaGroups = {};
            Severity: Major
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language