wikimedia/mediawiki-core

View on GitHub

Showing 11,773 of 11,773 total issues

File SQLPlatform.php has 1252 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: Major
Found in includes/libs/rdbms/platform/SQLPlatform.php - About 3 days to fix

    File ResourceLoader.php has 1247 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: Major
    Found in includes/ResourceLoader/ResourceLoader.php - About 3 days to fix

      File chosen.jquery.js has 1238 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
      Chosen, a Select Box Enhancer for jQuery and Prototype
      by Patrick Filler for Harvest, http://getharvest.com
      
      Version 1.8.2
      Severity: Major
      Found in resources/lib/jquery.chosen/chosen.jquery.js - About 3 days to fix

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

            switch ( form ) {
                case 'genitive':
                    // only a few declensions, and even for those mostly the singular only
                    word = word.replace( /u[ms]$/i, 'i' ); // 2nd declension singular
                    word = word.replace( /ommunia$/i, 'ommunium' ); // 3rd declension neuter plural (partly)
        Severity: Major
        Found in resources/src/mediawiki.language/languages/la.js and 1 other location - About 3 days to fix
        resources/lib/jquery.i18n/src/languages/la.js on lines 12..49

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

        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

                    switch ( form ) {
                        case 'genitive':
                        // only a few declensions, and even for those mostly the singular only
                            word = word.replace( /u[ms]$/i, 'i' ); // 2nd declension singular
                            word = word.replace( /ommunia$/i, 'ommunium' ); // 3rd declension neuter plural (partly)
        Severity: Major
        Found in resources/lib/jquery.i18n/src/languages/la.js and 1 other location - About 3 days to fix
        resources/src/mediawiki.language/languages/la.js on lines 11..48

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

        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 getHelpInternal has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function getHelpInternal( IContextSource $context, array $modules,
                array $options, &$haveModules
            ) {
                $out = '';
        
        
        Severity: Minor
        Found in includes/api/ApiHelp.php - About 3 days 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

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

            public $mToSyllabics = [
                'h' => 'ᐦ', 'i' => 'ᐃ', 'ii' => 'ᐄ', 'u' => 'ᐅ', 'uu' => 'ᐆ', 'a' => 'ᐊ', 'aa' => 'ᐋ',
                'p' => 'ᑉ', 'pi' => 'ᐱ', 'pii' => 'ᐲ', 'pu' => 'ᐳ', 'puu' => 'ᐴ', 'pa' => 'ᐸ', 'paa' => 'ᐹ',
                't' => 'ᑦ', 'ti' => 'ᑎ', 'tii' => 'ᑏ', 'tu' => 'ᑐ', 'tuu' => 'ᑑ', 'ta' => 'ᑕ', 'taa' => 'ᑖ',
                'k' => 'ᒃ', 'ki' => 'ᑭ', 'kii' => 'ᑮ', 'ku' => 'ᑯ', 'kuu' => 'ᑰ', 'ka' => 'ᑲ', 'kaa' => 'ᑳ',
        Severity: Major
        Found in includes/language/converters/IuConverter.php and 1 other location - About 3 days to fix
        includes/language/converters/IuConverter.php on lines 36..55

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

        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 $mToLatin = [
                'ᐦ' => 'h', 'ᐃ' => 'i', 'ᐄ' => 'ii', 'ᐅ' => 'u', 'ᐆ' => 'uu', 'ᐊ' => 'a', 'ᐋ' => 'aa',
                'ᑉ' => 'p', 'ᐱ' => 'pi', 'ᐲ' => 'pii', 'ᐳ' => 'pu', 'ᐴ' => 'puu', 'ᐸ' => 'pa', 'ᐹ' => 'paa',
                'ᑦ' => 't', 'ᑎ' => 'ti', 'ᑏ' => 'tii', 'ᑐ' => 'tu', 'ᑑ' => 'tuu', 'ᑕ' => 'ta', 'ᑖ' => 'taa',
                'ᒃ' => 'k', 'ᑭ' => 'ki', 'ᑮ' => 'kii', 'ᑯ' => 'ku', 'ᑰ' => 'kuu', 'ᑲ' => 'ka', 'ᑳ' => 'kaa',
        Severity: Major
        Found in includes/language/converters/IuConverter.php and 1 other location - About 3 days to fix
        includes/language/converters/IuConverter.php on lines 66..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 602.

        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

        ;(function (global, factory) {
           typeof exports === 'object' && typeof module !== 'undefined'
               && typeof require === 'function' ? factory(require('../moment')) :
           typeof define === 'function' && define.amd ? define(['../moment'], factory) :
           factory(global.moment)
        Severity: Major
        Found in resources/lib/moment/locale/kk.js and 1 other location - About 3 days to fix
        resources/lib/moment/locale/ky.js on lines 5..95

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

        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

        ;(function (global, factory) {
           typeof exports === 'object' && typeof module !== 'undefined'
               && typeof require === 'function' ? factory(require('../moment')) :
           typeof define === 'function' && define.amd ? define(['../moment'], factory) :
           factory(global.moment)
        Severity: Major
        Found in resources/lib/moment/locale/ky.js and 1 other location - About 3 days to fix
        resources/lib/moment/locale/kk.js on lines 5..93

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

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

          QUnit.diff = function () {
            function DiffMatchPatch() {}
        
            //  DIFF FUNCTIONS
        
        
        Severity: Major
        Found in resources/lib/qunitjs/qunit.js - About 3 days to fix

          Function setup has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring.
          Open

            setup(props, { emit, slots, attrs }) {
              const computedMenuItems = computed(() => {
                const menuItemsWithFooter = props.footer && props.menuItems ? [...props.menuItems, props.footer] : props.menuItems;
                return menuItemsWithFooter.map((menuItem) => __spreadProps(__spreadValues({}, menuItem), {
                  id: useGeneratedId("menu-item")
          Severity: Minor
          Found in resources/lib/codex/codex.js - About 3 days 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

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

          ;(function (global, factory) {
             typeof exports === 'object' && typeof module !== 'undefined'
                 && typeof require === 'function' ? factory(require('../moment')) :
             typeof define === 'function' && define.amd ? define(['../moment'], factory) :
             factory(global.moment)
          Severity: Major
          Found in resources/lib/moment/locale/jv.js and 3 other locations - About 3 days to fix
          resources/lib/moment/locale/id.js on lines 6..87
          resources/lib/moment/locale/ms-my.js on lines 6..87
          resources/lib/moment/locale/ms.js on lines 5..86

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

          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 4 locations. Consider refactoring.
          Open

          ;(function (global, factory) {
             typeof exports === 'object' && typeof module !== 'undefined'
                 && typeof require === 'function' ? factory(require('../moment')) :
             typeof define === 'function' && define.amd ? define(['../moment'], factory) :
             factory(global.moment)
          Severity: Major
          Found in resources/lib/moment/locale/ms-my.js and 3 other locations - About 3 days to fix
          resources/lib/moment/locale/id.js on lines 6..87
          resources/lib/moment/locale/jv.js on lines 6..87
          resources/lib/moment/locale/ms.js on lines 5..86

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

          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 4 locations. Consider refactoring.
          Open

          ;(function (global, factory) {
             typeof exports === 'object' && typeof module !== 'undefined'
                 && typeof require === 'function' ? factory(require('../moment')) :
             typeof define === 'function' && define.amd ? define(['../moment'], factory) :
             factory(global.moment)
          Severity: Major
          Found in resources/lib/moment/locale/ms.js and 3 other locations - About 3 days to fix
          resources/lib/moment/locale/id.js on lines 6..87
          resources/lib/moment/locale/jv.js on lines 6..87
          resources/lib/moment/locale/ms-my.js on lines 6..87

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

          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 4 locations. Consider refactoring.
          Open

          ;(function (global, factory) {
             typeof exports === 'object' && typeof module !== 'undefined'
                 && typeof require === 'function' ? factory(require('../moment')) :
             typeof define === 'function' && define.amd ? define(['../moment'], factory) :
             factory(global.moment)
          Severity: Major
          Found in resources/lib/moment/locale/id.js and 3 other locations - About 3 days to fix
          resources/lib/moment/locale/jv.js on lines 6..87
          resources/lib/moment/locale/ms-my.js on lines 6..87
          resources/lib/moment/locale/ms.js on lines 5..86

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

          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 sprintfDate has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
          Open

              public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = 'unused' ) {
                  // @phan-suppress-previous-line PhanTypeMismatchDefault Type mismatch on pass-by-ref args
                  $s = '';
                  $raw = false;
                  $roman = false;
          Severity: Minor
          Found in includes/language/Language.php - About 3 days 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

          DBConnRef has 153 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class DBConnRef implements IMaintainableDatabase {
              /** @var ILoadBalancer */
              private $lb;
              /** @var Database|null Live connection handle */
              private $conn;
          Severity: Major
          Found in includes/libs/rdbms/database/DBConnRef.php - About 3 days to fix

            Function check has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
            Open

                public function check( $fix = false, $xml = '' ) {
                    $dbr = $this->getReplicaDB();
                    if ( $fix ) {
                        print "Checking, will fix errors if possible...\n";
                    } else {
            Severity: Minor
            Found in maintenance/storage/checkStorage.php - About 2 days 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

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

            ;(function (global, factory) {
               typeof exports === 'object' && typeof module !== 'undefined'
                   && typeof require === 'function' ? factory(require('../moment')) :
               typeof define === 'function' && define.amd ? define(['../moment'], factory) :
               factory(global.moment)
            Severity: Major
            Found in resources/lib/moment/locale/de-ch.js and 2 other locations - About 2 days to fix
            resources/lib/moment/locale/de-at.js on lines 8..87
            resources/lib/moment/locale/de.js on lines 7..86

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

            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

            Severity
            Category
            Status
            Source
            Language