wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method saveUserGroups has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function saveUserGroups( string $reason, UserIdentity $user ) {
        if ( $this->userNameUtils->isTemp( $user->getName() ) ) {
            return Status::newFatal( 'userrights-no-tempuser' );
        }

Severity: Major
Found in includes/specials/SpecialUserRights.php - About 2 hrs to fix

    Method formatResult has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function formatResult( $skin, $result ) {
            $fromObj = Title::makeTitle( $result->namespace, $result->title );
            if ( isset( $result->rd_title ) ) {
                $toObj = Title::makeTitle(
                    $result->rd_namespace,
    Severity: Major
    Found in includes/specials/SpecialBrokenRedirects.php - About 2 hrs to fix

      Method getQueryInfo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getQueryInfo() {
              $opts = $this->opts;
              $conds = [];
              $dbr = $this->getDatabase();
              $tables = [ 'image', 'actor' ];
      Severity: Major
      Found in includes/specials/pagers/NewFilesPager.php - About 2 hrs to fix

        Method output has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function output( Throwable $e, $mode, Throwable $eNew = null ) {
                $showExceptionDetails = self::shouldShowExceptionDetails();
                if ( $e instanceof RequestTimeoutException && headers_sent() ) {
                    // Excimer's flag check happens on function return, so, a timeout
                    // can be thrown after exiting, say, `doPostOutputShutdown`, where
        Severity: Major
        Found in includes/exception/MWExceptionRenderer.php - About 2 hrs to fix

          Method pushBlobs has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function pushBlobs( RedisConnRef $conn, array $items ) {
                  $args = [ $this->encodeQueueName() ];
                  // Next args come in 4s ([id, sha1, rtime, blob [, id, sha1, rtime, blob ... ] ] )
                  foreach ( $items as $item ) {
                      $args[] = (string)$item['uuid'];
          Severity: Major
          Found in includes/jobqueue/JobQueueRedis.php - About 2 hrs to fix

            Method normalizeLinkUrl has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function normalizeLinkUrl( $url ) {
                    # Test for RFC 3986 IPv6 syntax
                    $scheme = '[a-z][a-z0-9+.-]*:';
                    $userinfo = '(?:[a-z0-9\-._~!$&\'()*+,;=:]|%[0-9a-f]{2})*';
                    $ipv6Host = '\\[((?:[0-9a-f:]|%3[0-A]|%[46][1-6])+)\\]';
            Severity: Major
            Found in includes/parser/Parser.php - About 2 hrs to fix

              Method getPageInfo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPageInfo( $pageConfigOrTitle, array $titles ): array {
                      if ( $pageConfigOrTitle instanceof IPageConfig ) {
                          $context_title = Title::newFromLinkTarget(
                              $pageConfigOrTitle->getLinkTarget()
                          );
              Severity: Major
              Found in includes/parser/Parsoid/Config/DataAccess.php - About 2 hrs to fix

                Method getMessageParameters has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function getMessageParameters() {
                        if ( $this->parsedParametersDeleteLog !== null ) {
                            return $this->parsedParametersDeleteLog;
                        }
                
                
                Severity: Major
                Found in includes/logging/DeleteLogFormatter.php - About 2 hrs to fix

                  Method saveSettings has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function saveSettings() {
                          if ( MediaWikiServices::getInstance()->getReadOnlyMode()->isReadOnly() ) {
                              // @TODO: caller should deal with this instead!
                              // This should really just be an exception.
                              MWExceptionHandler::logException( new DBExpectedError(
                  Severity: Major
                  Found in includes/user/User.php - About 2 hrs to fix

                    Method formatParameterValueForApi has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function formatParameterValueForApi( $name, $type, $value ) {
                            $type = strtolower( trim( $type ) );
                            switch ( $type ) {
                                case 'bool':
                                    $value = (bool)$value;
                    Severity: Major
                    Found in includes/logging/LogFormatter.php - About 2 hrs to fix

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

                          public function __construct( array $info = null ) {
                              // Verify required settings presence
                              if (
                                  $info === null
                                  || !array_key_exists( 'name', $info )
                      Severity: Major
                      Found in includes/filerepo/FileRepo.php - About 2 hrs to fix

                        Method load has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function load() {
                                if ( $this->procCache !== null ) {
                                    return; // already loaded
                                }
                        
                        
                        Severity: Major
                        Found in includes/config/EtcdConfig.php - About 2 hrs to fix

                          Method getAutosummary has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getAutosummary(
                                  Content $oldContent = null,
                                  Content $newContent = null,
                                  $flags = 0
                              ) {
                          Severity: Major
                          Found in includes/content/ContentHandler.php - About 2 hrs to fix

                            Method parseQuery has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function parseQuery( $filteredText, $fulltext ) {
                                    $lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); // Minus syntax chars (" and *)
                                    $searchon = '';
                                    $this->searchTerms = [];
                            
                            
                            Severity: Major
                            Found in includes/search/SearchSqlite.php - About 2 hrs to fix

                              Method loadWithArgv has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function loadWithArgv( array $argv, int $skip = 0 ) {
                                      $this->clear();
                              
                                      $options = [];
                                      $args = [];
                              Severity: Major
                              Found in maintenance/includes/MaintenanceParameters.php - About 2 hrs to fix

                                Method showReport has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function showReport() {
                                        if ( !$this->prefetch ) {
                                            parent::showReport();
                                
                                            return;
                                Severity: Major
                                Found in maintenance/includes/TextPassDumper.php - About 2 hrs to fix

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

                                      public function execute() {
                                          $file = $this->getOption( 'file',
                                              __DIR__ . '/data/CommentFormatter/rc100-2021-07-29.json' );
                                          $json = file_get_contents( $file );
                                          if ( !$json ) {
                                  Severity: Major
                                  Found in maintenance/benchmarks/benchmarkCommentFormatter.php - About 2 hrs to fix

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

                                        public function execute() {
                                            # Options processing
                                            $username = $this->getOption( 'u', false );
                                            $reason = $this->getOption( 'r', '' );
                                            $interval = $this->getOption( 'i', 0 );
                                    Severity: Major
                                    Found in maintenance/moveBatch.php - About 2 hrs to fix

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

                                      OO.ui.ComboBoxInputWidget.prototype.setDisabled = function () {
                                          // Parent method
                                          OO.ui.ComboBoxInputWidget.super.prototype.setDisabled.apply( this, arguments );
                                          this.updateControlsDisabled();
                                          return this;
                                      Severity: Major
                                      Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
                                      resources/lib/ooui/oojs-ui-core.js on lines 12728..12733
                                      resources/lib/ooui/oojs-ui-core.js on lines 14051..14056

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

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

                                      OO.ui.ComboBoxInputWidget.prototype.setReadOnly = function () {
                                          // Parent method
                                          OO.ui.ComboBoxInputWidget.super.prototype.setReadOnly.apply( this, arguments );
                                          this.updateControlsDisabled();
                                          return this;
                                      Severity: Major
                                      Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
                                      resources/lib/ooui/oojs-ui-core.js on lines 12718..12723
                                      resources/lib/ooui/oojs-ui-core.js on lines 14051..14056

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

                                      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