wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method extractAllSlotInfo has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function extractAllSlotInfo( RevisionRecord $revision, $revDel ): array {
        $vals = [];

        if ( $this->slotRoles === null ) {
            try {
Severity: Major
Found in includes/api/ApiQueryRevisionsBase.php - About 2 hrs to fix

    Method run has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function run( $resultPageSet = null ) {
            $params = $this->extractRequestParams();
            $result = $this->getResult();
    
            $qp = $this->getSpecialPage( $params['page'] );
    Severity: Major
    Found in includes/api/ApiQueryQueryPage.php - About 2 hrs to fix

      Method getFields has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getFields() {
              $fields = [
                  'Target' => [
                      'type' => 'text',
                      'label-message' => 'ipaddressorusername',
      Severity: Major
      Found in includes/specials/SpecialUnblock.php - About 2 hrs to fix

        Method doSaveUserGroups has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function doSaveUserGroups( $user, array $add, array $remove, string $reason = '',
                array $tags = [], array $groupExpiries = []
            ) {
                // Validate input set...
                $isself = $user->getName() == $this->getUser()->getName();
        Severity: Major
        Found in includes/specials/SpecialUserRights.php - About 2 hrs to fix

          Method initInternal has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function initInternal(
                  PageIdentity $page,
                  $body,
                  array $parameters,
                  ?RevisionRecord $originalRevision = null,
          Severity: Major
          Found in includes/Rest/Handler/Helper/HtmlInputTransformHelper.php - About 2 hrs to fix

            File MessagesEt.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              Method readDump has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function readDump( $input ) {
                      $this->buffer = "";
                      $this->openElement = false;
                      $this->atStart = true;
                      $this->state = "";
              Severity: Major
              Found in maintenance/includes/TextPassDumper.php - About 2 hrs to fix

                File MessagesFi.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Function main has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def main():
                      # Get Unihan.zip:
                      url = 'https://www.unicode.org/Public/%s/ucd/Unihan.zip' % UNIHAN_VER
                      han_dest = 'Unihan-%s.zip' % UNIHAN_VER
                      download(url, han_dest)
                  Severity: Major
                  Found in maintenance/language/zhtable/Makefile.py - About 2 hrs to fix

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

                                function choice( parserSyntax ) {
                                    return function () {
                                        var i, result;
                    
                                        for ( i = 0; i < parserSyntax.length; i++ ) {
                    Severity: Major
                    Found in resources/lib/jquery.i18n/src/jquery.i18n.parser.js and 1 other location - About 2 hrs to fix
                    resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js on lines 108..122

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

                    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

                        function choice(parserSyntax) {
                            return function() {
                                var i, result;
                    
                                for (i = 0; i < parserSyntax.length; i++) {
                    Severity: Major
                    Found in resources/lib/CLDRPluralRuleParser/CLDRPluralRuleParser.js and 1 other location - About 2 hrs to fix
                    resources/lib/jquery.i18n/src/jquery.i18n.parser.js on lines 56..70

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

                    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

                                this.element.siblings( ":visible" ).each(function() {
                                    var elem = $( this ),
                                        position = elem.css( "position" );
                    
                                    if ( position === "absolute" || position === "fixed" ) {
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.accordion.js and 1 other location - About 2 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.tabs.js on lines 508..516

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

                    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.CheckboxInputWidget.prototype.isSelected = function () {
                        // Resynchronize our internal data with DOM data. Other scripts executing on the page can modify
                        // it, and we won't know unless they're kind enough to trigger a 'change' event.
                        const selected = this.$input.prop( 'checked' );
                        if ( this.selected !== selected ) {
                    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 10515..10523

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

                    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

                                this.element.siblings( ":visible" ).each(function() {
                                    var elem = $( this ),
                                        position = elem.css( "position" );
                    
                                    if ( position === "absolute" || position === "fixed" ) {
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.tabs.js and 1 other location - About 2 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.accordion.js on lines 301..309

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

                    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.CheckboxInputWidget.prototype.isIndeterminate = function () {
                        // Resynchronize our internal data with DOM data. Other scripts executing on the page can modify
                        // it, and we won't know unless they're kind enough to trigger a 'change' event.
                        const indeterminate = this.$input.prop( 'indeterminate' );
                        if ( this.indeterminate !== indeterminate ) {
                    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 10479..10487

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

                    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

                            meridiemHour: function (hour, meridiem) {
                                if (hour === 12) {
                                    hour = 0;
                                }
                                if (
                    Severity: Major
                    Found in resources/lib/moment/locale/bo.js and 1 other location - About 2 hrs to fix
                    resources/lib/moment/locale/bn.js on lines 94..107

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

                    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

                            meridiemHour: function (hour, meridiem) {
                                if (hour === 12) {
                                    hour = 0;
                                }
                                if (
                    Severity: Major
                    Found in resources/lib/moment/locale/bn.js and 1 other location - About 2 hrs to fix
                    resources/lib/moment/locale/bo.js on lines 98..111

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

                    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 _sfc_render$r has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
                      const _component_cdx_icon = resolveComponent("cdx-icon");
                      return !_ctx.isLegend ? (openBlock(), createElementBlock(
                        "div",
                        {
                    Severity: Minor
                    Found in resources/lib/codex/codex.js - About 2 hrs to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function buildForm has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function buildForm() {
                            $this->mOut->enableOOUI();
                            $out = '';
                            $fields = [];
                            if ( !$this->disabled ) {
                    Severity: Minor
                    Found in includes/page/ProtectionForm.php - About 2 hrs to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function buildBadFilesList has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function buildBadFilesList( string $list ): array {
                            $ret = [];
                            $lines = explode( "\n", $list );
                            foreach ( $lines as $line ) {
                                // List items only
                    Severity: Minor
                    Found in includes/page/File/BadFileLookup.php - About 2 hrs to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language