wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method transformGd has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function transformGd( $image, $params ) {
        # Use PHP's builtin GD library functions.
        # First find out what kind of file this is, and select the correct
        # input routine for this.

Severity: Major
Found in includes/media/BitmapHandler.php - About 2 hrs to fix

    Method loadRequest has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function loadRequest( $par ) {
            $request = $this->getRequest();
            $user = $this->getUser();
    
            $this->mAction = $request->getRawVal( 'action' );
    Severity: Major
    Found in includes/specials/SpecialUndelete.php - About 2 hrs to fix

      Method checkLastModified has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function checkLastModified( $timestamp ) {
              if ( !$timestamp || $timestamp == '19700101000000' ) {
                  wfDebug( __METHOD__ . ': CACHE DISABLED, NO TIMESTAMP' );
                  return false;
              }
      Severity: Major
      Found in includes/Output/OutputPage.php - About 2 hrs to fix

        Method showOptions has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function showOptions( $type = '', $year = 0, $month = 0, $day = 0 ) {
                $formDescriptor = [];
        
                // Basic selectors
                $formDescriptor['type'] = $this->getTypeMenuDesc();
        Severity: Major
        Found in includes/logging/LogEventsList.php - About 2 hrs to fix

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

              public function execute() {
                  $repo = $this->file->repo;
                  $status = $repo->newGood();
          
                  $status->merge( $this->acquireSourceLock() );
          Severity: Major
          Found in includes/filerepo/file/LocalFileMoveBatch.php - About 2 hrs to fix

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

                public function execute() {
                    $lang = $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'en' );
                    $title = Title::newFromText( $this->getArg( 0 ) );
            
                    if ( $this->hasOption( 'start' ) ) {
            Severity: Major
            Found in maintenance/storage/testCompression.php - About 2 hrs to fix

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

                  public function execute() {
                      $pages = $this->getOption( 'maxpages' );
              
                      $dbr = $this->getReplicaDB();
              
              
              Severity: Major
              Found in maintenance/compareParserCache.php - About 2 hrs to fix

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

                    public function execute() {
                        $userName = $this->getOption( 'user', false );
                        $summary = $this->getOption( 'summary', '' );
                        $remove = $this->hasOption( 'remove' );
                        $minor = $this->hasOption( 'minor' );
                Severity: Major
                Found in maintenance/edit.php - About 2 hrs to fix

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

                          if ( $this->isStructuredFilterUiEnabled() ) {
                              $rcfilterContainer = Html::element(
                                  'div',
                                  [ 'class' => 'mw-rcfilters-container' ]
                              );
                  Severity: Major
                  Found in includes/specials/SpecialRecentChanges.php and 1 other location - About 2 hrs to fix
                  includes/specials/SpecialWatchlist.php on lines 823..851

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

                  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 ( $this->isStructuredFilterUiEnabled() ) {
                              $rcfilterContainer = Html::element(
                                  'div',
                                  [ 'class' => 'mw-rcfilters-container' ]
                              );
                  Severity: Major
                  Found in includes/specials/SpecialWatchlist.php and 1 other location - About 2 hrs to fix
                  includes/specials/SpecialRecentChanges.php on lines 692..720

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

                  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 ApiQueryUsers.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Consider simplifying this complex logical expression.
                    Open

                            if (a && getParsingFlags(m).overflow === -2) {
                                overflow =
                                    a[MONTH] < 0 || a[MONTH] > 11
                                        ? MONTH
                                        : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
                    Severity: Critical
                    Found in resources/lib/moment/moment.js - About 2 hrs to fix

                      DeletePage has 24 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class DeletePage {
                          /**
                           * @internal For use by PageCommandFactory
                           */
                          public const CONSTRUCTOR_OPTIONS = [
                      Severity: Minor
                      Found in includes/page/DeletePage.php - About 2 hrs to fix

                        XmlDumpWriter has 24 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class XmlDumpWriter {
                        
                            /** Output serialized revision content. */
                            public const WRITE_CONTENT = 0;
                        
                        
                        Severity: Minor
                        Found in includes/export/XmlDumpWriter.php - About 2 hrs to fix

                          GlobalIdGenerator has 24 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class GlobalIdGenerator {
                              /** @var callable Callback for running shell commands */
                              protected $shellCallback;
                          
                              /** @var string Temporary directory */
                          Severity: Minor
                          Found in includes/libs/uuid/GlobalIdGenerator.php - About 2 hrs to fix

                            ImageGalleryBase has 24 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            abstract class ImageGalleryBase extends ContextSource {
                                public const LOADING_DEFAULT = 1;
                                public const LOADING_LAZY = 2;
                            
                                /**
                            Severity: Minor
                            Found in includes/gallery/ImageGalleryBase.php - About 2 hrs to fix

                              SiteList has 24 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class SiteList extends ArrayObject {
                                  /**
                                   * @see SiteList::getNewOffset()
                                   * @since 1.20
                                   * @var int
                              Severity: Minor
                              Found in includes/site/SiteList.php - About 2 hrs to fix

                                FormatMetadata has 24 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class FormatMetadata extends ContextSource {
                                    use ProtectedHookAccessorTrait;
                                
                                    /**
                                     * Only output a single language for multi-language fields
                                Severity: Minor
                                Found in includes/media/FormatMetadata.php - About 2 hrs to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                              if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
                                                  || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
                                                  || ( isset( $show['autopatrolled'] ) && isset( $show['!autopatrolled'] ) )
                                                  || ( isset( $show['autopatrolled'] ) && isset( $show['!patrolled'] ) )
                                                  || ( isset( $show['top'] ) && isset( $show['!top'] ) )
                                  Severity: Critical
                                  Found in includes/api/ApiQueryUserContribs.php - About 2 hrs to fix

                                    DerivativeContext has 24 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class DerivativeContext extends ContextSource implements MutableContext {
                                        /**
                                         * @var WebRequest
                                         */
                                        private $request;
                                    Severity: Minor
                                    Found in includes/context/DerivativeContext.php - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language