wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method parse has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parse( $variant = null ) {
        if ( !$variant ) {
            $variant = $this->mConverter->getPreferredVariant();
        }

Severity: Major
Found in includes/language/ConverterRule.php - About 3 hrs to fix

    Method setCookie has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setCookie( $name, $value, $expire = 0, $options = [] ) {
            $services = MediaWikiServices::getInstance();
            $mainConfig = $services->getMainConfig();
            $cookiePath = $mainConfig->get( MainConfigNames::CookiePath );
            $cookiePrefix = $mainConfig->get( MainConfigNames::CookiePrefix );
    Severity: Major
    Found in includes/Request/WebResponse.php - About 3 hrs to fix

      Method form has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function form() {
              $out = $this->getOutput();
      
              // Consume values
              $this->opts->consumeValue( 'offset' ); // don't carry offset, DWIW
      Severity: Major
      Found in includes/specials/SpecialNewPages.php - About 3 hrs to fix

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

            public function execute() {
                $async = $this->hasOption( 'async' );
                $dryrun = $this->hasOption( 'dry-run' );
        
                if ( $this->hasOption( 'title' ) ) {
        Severity: Major
        Found in maintenance/fixDoubleRedirects.php - About 3 hrs to fix

          File FullSearchResultWidget.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace MediaWiki\Search\SearchWidgets;
          
          use File;
          Severity: Minor
          Found in includes/search/searchwidgets/FullSearchResultWidget.php - About 3 hrs to fix

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

                public function parseAsContent( $text, $linestart = true ) {
                    $title = $this->getTitle();
                    if ( $title === null ) {
                        throw new RuntimeException( 'No title in ' . __METHOD__ );
                    }
            Severity: Major
            Found in includes/Output/OutputPage.php and 1 other location - About 3 hrs to fix
            includes/Output/OutputPage.php on lines 2610..2626

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

            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

                        case 'edits':
                            $from = $this->getValidatedParams()['from'] ?? null;
                            $to = $this->getValidatedParams()['to'] ?? null;
                            if ( $from || $to ) {
                                return $this->getEditsCount(
            Severity: Major
            Found in includes/Rest/Handler/PageHistoryCountHandler.php and 1 other location - About 3 hrs to fix
            includes/Rest/Handler/PageHistoryCountHandler.php on lines 231..245

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

            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

                        case 'editors':
                            $from = $this->getValidatedParams()['from'] ?? null;
                            $to = $this->getValidatedParams()['to'] ?? null;
                            if ( $from || $to ) {
                                return $this->getEditorsCount(
            Severity: Major
            Found in includes/Rest/Handler/PageHistoryCountHandler.php and 1 other location - About 3 hrs to fix
            includes/Rest/Handler/PageHistoryCountHandler.php on lines 247..262

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

            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 function parseAsInterface( $text, $linestart = true ) {
                    $title = $this->getTitle();
                    if ( $title === null ) {
                        throw new RuntimeException( 'No title in ' . __METHOD__ );
                    }
            Severity: Major
            Found in includes/Output/OutputPage.php and 1 other location - About 3 hrs to fix
            includes/Output/OutputPage.php on lines 2581..2597

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

            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

            Method doQuery has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function doQuery() {
                    if ( $this->mQueryDone ) {
                        return;
                    }
                    $this->mImg = $this->mImagePage->getPage()->getFile(); // ensure loading
            Severity: Major
            Found in includes/page/ImageHistoryPseudoPager.php - About 3 hrs to fix

              Method setUsernameBitfields has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function setUsernameBitfields( $name, $userId, $op, IDatabase $dbw = null ) {
                      if ( !$userId || ( $op !== '|' && $op !== '&' ) ) {
                          return false;
                      }
                      if ( !$dbw instanceof IDatabase ) {
              Severity: Major
              Found in includes/revisiondelete/RevisionDeleteUser.php - About 3 hrs to fix

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

                    private function run( $resultPageSet = null ) {
                        $params = $this->extractRequestParams();
                
                        $user = $this->getWatchlistUser( $params );
                
                
                Severity: Major
                Found in includes/api/ApiQueryWatchlistRaw.php - About 3 hrs to fix

                  Method __construct has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct( $context = null, $enableWrite = false, $internal = null ) {
                          if ( $context === null ) {
                              $context = RequestContext::getMain();
                          } elseif ( $context instanceof WebRequest ) {
                              // BC for pre-1.19
                  Severity: Major
                  Found in includes/api/ApiMain.php - About 3 hrs to fix

                    Method outputGeneralPageInfo has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function outputGeneralPageInfo() {
                            $pageSet = $this->getPageSet();
                            $result = $this->getResult();
                    
                            // We can't really handle max-result-size failure here, but we need to
                    Severity: Major
                    Found in includes/api/ApiQuery.php - About 3 hrs to fix

                      Method loadFromRow has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function loadFromRow( $row, $data = null ) {
                              if ( !is_object( $row ) ) {
                                  throw new InvalidArgumentException( '$row must be an object' );
                              }
                      
                      
                      Severity: Major
                      Found in includes/user/User.php - About 3 hrs to fix

                        Method getText has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function getText( $id, $model = null, $format = null, $expSize = null ) {
                                if ( !$this->isValidTextId( $id ) ) {
                                    $msg = "Skipping bad text id " . $id . " of revision " . $this->thisRev;
                                    $this->progress( $msg );
                                    return '';
                        Severity: Major
                        Found in maintenance/includes/TextPassDumper.php - About 3 hrs to fix

                          File MessagesTg_cyrl.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /** Tajik (Cyrillic script) (тоҷикӣ)
                           *
                           * @file
                           * @ingroup Languages
                          Severity: Minor
                          Found in languages/messages/MessagesTg_cyrl.php - About 3 hrs to fix

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

                                public function execute() {
                                    $exampleKeys = [];
                                    $max = 100;
                                    $count = 500;
                                    while ( $count-- ) {
                            Severity: Major
                            Found in maintenance/benchmarks/benchmarkLruHash.php - About 3 hrs to fix

                              Method checkNamespace has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function checkNamespace( $ns, $name, $options ) {
                                      $targets = $this->getTargetList( $ns, $name, $options );
                                      $count = $targets->numRows();
                                      $this->totalPages += $count;
                                      if ( $count == 0 ) {
                              Severity: Major
                              Found in maintenance/namespaceDupes.php - About 3 hrs to fix

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

                                OO.ui.SelectWidget.prototype.findHighlightedItem = function () {
                                    for ( let i = 0; i < this.items.length; i++ ) {
                                        if ( this.items[ i ].isHighlighted() ) {
                                            return this.items[ i ];
                                        }
                                Severity: Major
                                Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 3 hrs to fix
                                resources/lib/ooui/oojs-ui-core.js on lines 7686..7693

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

                                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