wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method prepareQuickTemplate has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function prepareQuickTemplate() {
        $title = $this->getTitle();
        $request = $this->getRequest();
        $out = $this->getOutput();
        $config = $this->getConfig();
Severity: Major
Found in includes/skins/SkinTemplate.php - About 4 hrs to fix

    Method execute has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute( $par ) {
            $config = $this->getConfig();
            $credits = self::getCredits( ExtensionRegistry::getInstance(), $config );
    
            $this->setHeaders();
    Severity: Major
    Found in includes/specials/SpecialVersion.php - About 4 hrs to fix

      File PageHistoryHandler.php has 353 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace MediaWiki\Rest\Handler;
      
      use ChangeTags;
      Severity: Minor
      Found in includes/Rest/Handler/PageHistoryHandler.php - About 4 hrs to fix

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

            private const UPPER_TO_LOWER_CASE_LATIN = [
                'A' => 'a',
                'B' => 'b',
                'G' => 'g',
                'D' => 'd',
        Severity: Major
        Found in includes/language/converters/ShiConverter.php and 1 other location - About 4 hrs to fix
        includes/GlobalFunctions.php on lines 1090..1107

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

        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

                $repl = [
                    '"' => '&#34;', '&' => '&#38;', "'" => '&#39;', '<' => '&#60;',
                    '=' => '&#61;', '>' => '&#62;', '[' => '&#91;', ']' => '&#93;',
                    '{' => '&#123;', '|' => '&#124;', '}' => '&#125;',
                    ';' => '&#59;', // a token inside language converter brackets
        Severity: Major
        Found in includes/GlobalFunctions.php and 1 other location - About 4 hrs to fix
        includes/language/converters/ShiConverter.php on lines 78..113

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

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

            function weekdaysMinRegex(isStrict) {
                if (this._weekdaysParseExact) {
                    if (!hasOwnProp(this, '_weekdaysRegex')) {
                        computeWeekdaysParse.call(this);
                    }
        Severity: Major
        Found in resources/lib/moment/moment.js and 4 other locations - About 4 hrs to fix
        resources/lib/moment/moment.js on lines 1129..1147
        resources/lib/moment/moment.js on lines 1149..1167
        resources/lib/moment/moment.js on lines 1749..1767
        resources/lib/moment/moment.js on lines 1769..1787

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

        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

                relativeTime: {
                    future: 'بعد %s',
                    past: 'منذ %s',
                    s: pluralize('s'),
                    ss: pluralize('s'),
        Severity: Major
        Found in resources/lib/moment/locale/ar.js and 1 other location - About 4 hrs to fix
        resources/lib/moment/locale/ar-ly.js on lines 148..163

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

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

            function weekdaysRegex(isStrict) {
                if (this._weekdaysParseExact) {
                    if (!hasOwnProp(this, '_weekdaysRegex')) {
                        computeWeekdaysParse.call(this);
                    }
        Severity: Major
        Found in resources/lib/moment/moment.js and 4 other locations - About 4 hrs to fix
        resources/lib/moment/moment.js on lines 1129..1147
        resources/lib/moment/moment.js on lines 1149..1167
        resources/lib/moment/moment.js on lines 1769..1787
        resources/lib/moment/moment.js on lines 1789..1807

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

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

            function monthsShortRegex(isStrict) {
                if (this._monthsParseExact) {
                    if (!hasOwnProp(this, '_monthsRegex')) {
                        computeMonthsParse.call(this);
                    }
        Severity: Major
        Found in resources/lib/moment/moment.js and 4 other locations - About 4 hrs to fix
        resources/lib/moment/moment.js on lines 1149..1167
        resources/lib/moment/moment.js on lines 1749..1767
        resources/lib/moment/moment.js on lines 1769..1787
        resources/lib/moment/moment.js on lines 1789..1807

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

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

            function weekdaysShortRegex(isStrict) {
                if (this._weekdaysParseExact) {
                    if (!hasOwnProp(this, '_weekdaysRegex')) {
                        computeWeekdaysParse.call(this);
                    }
        Severity: Major
        Found in resources/lib/moment/moment.js and 4 other locations - About 4 hrs to fix
        resources/lib/moment/moment.js on lines 1129..1147
        resources/lib/moment/moment.js on lines 1149..1167
        resources/lib/moment/moment.js on lines 1749..1767
        resources/lib/moment/moment.js on lines 1789..1807

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

        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

                relativeTime: {
                    future: 'بعد %s',
                    past: 'منذ %s',
                    s: pluralize('s'),
                    ss: pluralize('s'),
        Severity: Major
        Found in resources/lib/moment/locale/ar-ly.js and 1 other location - About 4 hrs to fix
        resources/lib/moment/locale/ar.js on lines 162..177

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

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

            function monthsRegex(isStrict) {
                if (this._monthsParseExact) {
                    if (!hasOwnProp(this, '_monthsRegex')) {
                        computeMonthsParse.call(this);
                    }
        Severity: Major
        Found in resources/lib/moment/moment.js and 4 other locations - About 4 hrs to fix
        resources/lib/moment/moment.js on lines 1129..1147
        resources/lib/moment/moment.js on lines 1749..1767
        resources/lib/moment/moment.js on lines 1769..1787
        resources/lib/moment/moment.js on lines 1789..1807

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

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

            function execute( module ) {
                if ( registry[ module ].state !== 'loaded' ) {
                    throw new Error( 'Module in state "' + registry[ module ].state + '" may not execute: ' + module );
                }
        
        
        Severity: Major
        Found in resources/src/startup/mediawiki.loader.js - About 4 hrs to fix

          Function SuiteReport has 111 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var SuiteReport = /*#__PURE__*/function () {
              function SuiteReport(name, parentSuite) {
                _classCallCheck(this, SuiteReport);
                this.name = name;
                this.fullName = parentSuite ? parentSuite.fullName.concat(name) : [];
          Severity: Major
          Found in resources/lib/qunitjs/qunit.js - About 4 hrs to fix

            Method limit has 111 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function limit( RateLimitSubject $subject, string $action, int $incrBy = 1 ) {
                    // Bypass limit checks for actions that are defined to be non-limitable.
                    // This is a performance optimization.
                    if ( $this->nonLimitableActions[$action] ?? false ) {
                        return false;
            Severity: Major
            Found in includes/Permissions/RateLimiter.php - About 4 hrs to fix

              Method save has 111 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function save( $closing = false ) {
                      $anon = $this->user->isAnon();
              
                      if ( !$anon && $this->provider->getManager()->isUserSessionPrevented( $this->user->getName() ) ) {
                          $this->logger->debug(
              Severity: Major
              Found in includes/session/SessionBackend.php - About 4 hrs to fix

                Method validateValue has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function validateValue( $name, $value, $settings, array $options = [] ) {
                        $settings = $this->normalizeSettings( $settings );
                
                        $typeDef = $this->getTypeDef( $settings[self::PARAM_TYPE] );
                        if ( !$typeDef ) {
                Severity: Major
                Found in includes/libs/ParamValidator/ParamValidator.php - About 4 hrs to fix

                  Method performRequest has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function performRequest() {
                          global $wgTitle;
                  
                          $context = $this->getContext();
                  
                  
                  Severity: Major
                  Found in includes/actions/ActionEntryPoint.php - About 4 hrs to fix

                    Method execute has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function execute() {
                            // ConvertibleTimestamp::time() used so we can fake the current time in tests
                            $endTime = ConvertibleTimestamp::time() + self::MAX_EXECUTE_SECONDS;
                    
                            $props = array_fill_keys( $this->getParameter( 'prop' ), true );
                    Severity: Major
                    Found in includes/api/ApiQueryLanguageinfo.php - About 4 hrs to fix

                      Method execute has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function execute() {
                              $force = $this->hasOption( 'force' );
                              $threads = $this->getOption( 'threads', 1 );
                              if ( $threads < 1 || $threads != intval( $threads ) ) {
                                  $this->output( "Invalid thread count specified; running single-threaded.\n" );
                      Severity: Major
                      Found in maintenance/rebuildLocalisationCache.php - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language