wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

File MWHttpRequest.php has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
Severity: Minor
Found in includes/http/MWHttpRequest.php - About 4 hrs to fix

    Method getJSVars has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getJSVars( ?int $flag = null ) {
            $curRevisionId = 0;
            $articleId = 0;
            $canonicalSpecialPageName = false; # T23115
            $services = MediaWikiServices::getInstance();
    Severity: Major
    Found in includes/Output/OutputPage.php - About 4 hrs to fix

      File SpecialTags.php has 369 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * This program is free software; you can redistribute it and/or modify
       * it under the terms of the GNU General Public License as published by
       * the Free Software Foundation; either version 2 of the License, or
      Severity: Minor
      Found in includes/specials/SpecialTags.php - About 4 hrs to fix

        File ForeignAPIRepo.php has 369 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * This program is free software; you can redistribute it and/or modify
         * it under the terms of the GNU General Public License as published by
         * the Free Software Foundation; either version 2 of the License, or
        Severity: Minor
        Found in includes/filerepo/ForeignAPIRepo.php - About 4 hrs to fix

          File RemexCompatMunger.php has 369 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace MediaWiki\Tidy;
          
          use InvalidArgumentException;
          Severity: Minor
          Found in includes/tidy/RemexCompatMunger.php - About 4 hrs to fix

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

                            'policies' => [
                                'bureaucrat' => [
                                    'MinimalPasswordLength' => 10,
                                    'MinimumPasswordLengthToLogin' => 1,
                                ],
            Severity: Major
            Found in includes/config-schema.php and 1 other location - About 4 hrs to fix
            includes/MainConfigSchema.php on lines 7001..7028

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

            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

                        'policies' => [
                            'bureaucrat' => [
                                'MinimalPasswordLength' => 10,
                                'MinimumPasswordLengthToLogin' => 1,
                            ],
            Severity: Major
            Found in includes/MainConfigSchema.php and 1 other location - About 4 hrs to fix
            includes/config-schema.php on lines 846..885

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

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

                $.fn.makeCollapsible = function ( options ) {
                    options = options || {};
            
                    this.each( function () {
                        // Ensure class "mw-collapsible" is present in case .makeCollapsible()
            Severity: Major
            Found in resources/src/jquery/jquery.makeCollapsible.js - About 4 hrs to fix

              Function goAsync has 121 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        goAsync: function goAsync(search, targets, options) {
                          var canceled = false;
                          var p = new Promise(function (resolve, reject) {
                            if (search == 'farzher') return resolve([{
                              target: "farzher was here (^-^*)/",
              Severity: Major
              Found in resources/lib/qunitjs/qunit.js - About 4 hrs to fix

                Function Callbacks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jQuery.Callbacks = function( options ) {
                
                    // Convert options from String-formatted to Object-formatted if needed
                    // (we check in cache first)
                    options = typeof options === "string" ?
                Severity: Major
                Found in resources/lib/jquery/jquery.js - About 4 hrs to fix

                  Method importFormDataPosted has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function importFormDataPosted( WebRequest $request ): void {
                          # These fields need to be checked for encoding.
                          # Also remove trailing whitespace, but don't remove _initial_
                          # whitespace from the text boxes. This may be significant formatting.
                          $this->textbox1 = rtrim( $request->getText( 'wpTextbox1' ) );
                  Severity: Major
                  Found in includes/editpage/EditPage.php - About 4 hrs to fix

                    Method getHeadLinksArray has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getHeadLinksArray() {
                            $tags = [];
                            $config = $this->getConfig();
                    
                            if ( $this->cspOutputMode === self::CSP_META ) {
                    Severity: Major
                    Found in includes/Output/OutputPage.php - About 4 hrs to fix

                      BagOStuff has 37 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class BagOStuff implements
                          ExpirationAwareness,
                          StorageAwareness,
                          IStoreKeyEncoder,
                          LoggerAwareInterface
                      Severity: Minor
                      Found in includes/libs/objectcache/BagOStuff.php - About 4 hrs to fix

                        IndexPager has 37 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        abstract class IndexPager extends ContextSource implements Pager {
                        
                            /** Backwards-compatible constant for $mDefaultDirection field (do not change) */
                            public const DIR_ASCENDING = false;
                            /** Backwards-compatible constant for $mDefaultDirection field (do not change) */
                        Severity: Minor
                        Found in includes/pager/IndexPager.php - About 4 hrs to fix

                          ApiQuerySiteinfo has 37 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class ApiQuerySiteinfo extends ApiQueryBase {
                          
                              private UserOptionsLookup $userOptionsLookup;
                              private UserGroupManager $userGroupManager;
                              private LanguageConverterFactory $languageConverterFactory;
                          Severity: Minor
                          Found in includes/api/ApiQuerySiteinfo.php - About 4 hrs to fix

                            JobQueueRedis has 37 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class JobQueueRedis extends JobQueue {
                                /** @var RedisConnectionPool */
                                protected $redisPool;
                                /** @var LoggerInterface */
                                protected $logger;
                            Severity: Minor
                            Found in includes/jobqueue/JobQueueRedis.php - About 4 hrs to fix

                              HtmlToContentTransform has 37 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class HtmlToContentTransform {
                                  private array $options = [];
                                  private ?int $oldid = null;
                                  private ?Bcp47Code $contentLanguage = null;
                                  private ?Content $originalContent = null;
                              Severity: Minor
                              Found in includes/parser/Parsoid/HtmlToContentTransform.php - About 4 hrs to fix

                                RecentChange has 37 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class RecentChange implements Taggable {
                                    use DeprecationHelper;
                                
                                    // Constants for the rc_source field.  Extensions may also have
                                    // their own source constants.
                                Severity: Minor
                                Found in includes/recentchanges/RecentChange.php - About 4 hrs to fix

                                  File ApiParamInfo.php has 368 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  /**
                                   * Copyright © 2008 Roan Kattouw <roan.kattouw@gmail.com>
                                   *
                                   * This program is free software; you can redistribute it and/or modify
                                  Severity: Minor
                                  Found in includes/api/ApiParamInfo.php - About 4 hrs to fix

                                    File UploadForm.php has 367 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    /**
                                     * This program is free software; you can redistribute it and/or modify
                                     * it under the terms of the GNU General Public License as published by
                                     * the Free Software Foundation; either version 2 of the License, or
                                    Severity: Minor
                                    Found in includes/specials/forms/UploadForm.php - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language