wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method processUser has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processUser( string $value ): array {
        // A user ID?
        if ( preg_match( '/^#(\d+)$/D', $value, $m ) ) {
            // This used to use the IP address of the current request if the
            // id was 0, to match the behavior of User objects, but was switched
Severity: Major
Found in includes/ParamValidator/TypeDef/UserDef.php - About 2 hrs to fix

    Method parseAndCache has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parseAndCache( $pageUpdater, Content $content, UserIdentity $user, string $summary ) {
            $logger = $this->logger;
    
            if ( $pageUpdater instanceof WikiPage ) {
                wfDeprecated( __METHOD__ . ' with WikiPage instance', '1.42' );
    Severity: Major
    Found in includes/Storage/PageEditStash.php - About 2 hrs to fix

      Method open has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function open( $server, $user, $password, $db, $schema, $tablePrefix ) {
              $this->close( __METHOD__ );
      
              // Note that for SQLite, $server, $user, and $pass are ignored
      
      
      Severity: Major
      Found in includes/libs/rdbms/database/DatabaseSqlite.php - About 2 hrs to fix

        Method getDefaultModules has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getDefaultModules() {
                $out = $this->getOutput();
                $user = $this->getUser();
        
                // Modules declared in the $modules literal are loaded
        Severity: Major
        Found in includes/skins/Skin.php - About 2 hrs to fix

          Method getLocalURL has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getLocalURL( $query = '' ) {
                  global $wgArticlePath, $wgScript, $wgMainPageIsDomainRoot;
          
                  $query = is_array( $query ) ? wfArrayToCgi( $query ) : $query;
          
          
          Severity: Major
          Found in includes/title/Title.php - About 2 hrs to fix

            Method transformImageMagickExt has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function transformImageMagickExt( $image, $params ) {
                    $mainConfig = MediaWikiServices::getInstance()->getMainConfig();
                    $sharpenReductionThreshold = $mainConfig->get( MainConfigNames::SharpenReductionThreshold );
                    $sharpenParameter = $mainConfig->get( MainConfigNames::SharpenParameter );
                    $maxAnimatedGifArea = $mainConfig->get( MainConfigNames::MaxAnimatedGifArea );
            Severity: Major
            Found in includes/media/BitmapHandler.php - About 2 hrs to fix

              Method makeLegend has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function makeLegend() {
                      $context = $this->getContext();
                      $user = $context->getUser();
                      # The legend showing what the letters and stuff mean
                      $legend = Html::openElement( 'dl' ) . "\n";
              Severity: Major
              Found in includes/specialpage/ChangesListSpecialPage.php - About 2 hrs to fix

                Method getAllowedParams has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getAllowedParams( $flags = 0 ) {
                        $userGroups = $this->userGroupManager->listAllGroups();
                
                        if ( $flags & ApiBase::GET_VALUES_FOR_HELP ) {
                            sort( $userGroups );
                Severity: Major
                Found in includes/api/ApiQueryAllUsers.php - About 2 hrs to fix

                  Method outputChangesList has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function outputChangesList( $rows, $opts ) {
                          $limit = $opts['limit'];
                  
                          $showWatcherCount = $this->getConfig()->get( MainConfigNames::RCShowWatchingUsers )
                              && $this->userOptionsLookup->getBoolOption( $this->getUser(), 'shownumberswatching' );
                  Severity: Major
                  Found in includes/specials/SpecialRecentChanges.php - About 2 hrs to fix

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

                        public function getQueryInfo() {
                            $dbr = $this->getDatabase();
                            $conds = [
                                $dbr->expr( 'pr_expiry', '>', $dbr->timestamp() )
                                    ->or( 'pr_expiry', '=', null ),
                    Severity: Major
                    Found in includes/specials/pagers/ProtectedPagesPager.php - About 2 hrs to fix

                      Method magicLinkCallback has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function magicLinkCallback( array $m ) {
                              if ( isset( $m[1] ) && $m[1] !== '' ) {
                                  # Skip anchor
                                  return $m[0];
                              } elseif ( isset( $m[2] ) && $m[2] !== '' ) {
                      Severity: Major
                      Found in includes/parser/Parser.php - About 2 hrs to fix

                        Method detectScript has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function detectScript( $file, $mime, $extension ) {
                                # ugly hack: for text files, always look at the entire file.
                                # For binary field, just check the first K.
                        
                                if ( str_starts_with( $mime ?? '', 'text/' ) ) {
                        Severity: Major
                        Found in includes/upload/UploadBase.php - About 2 hrs to fix

                          Method render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function render( SearchResult $result, $position ) {
                                  // If the page doesn't *exist*... our search index is out of date.
                                  // The least confusing at this point is to drop the result.
                                  // You may get less results, but... on well. :P
                                  if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
                          Severity: Major
                          Found in includes/search/searchwidgets/FullSearchResultWidget.php - About 2 hrs to fix

                            Method getLine has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getLine( array $feed, RecentChange $rc, $actionComment ) {
                                    $services = MediaWikiServices::getInstance();
                                    $mainConfig = $services->getMainConfig();
                                    $localInterwikis = $mainConfig->get( MainConfigNames::LocalInterwikis );
                                    $useRCPatrol = $mainConfig->get( MainConfigNames::UseRCPatrol );
                            Severity: Major
                            Found in includes/recentchanges/RCFeed/IRCColourfulRCFeedFormatter.php - About 2 hrs to fix

                              Method copyFileBatch has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function copyFileBatch(
                                      array $srcPathsRel, $backendRel, FileBackend $src, FileBackend $dst
                                  ) {
                                      $ops = [];
                                      $fsFiles = [];
                              Severity: Major
                              Found in maintenance/copyFileBackend.php - About 2 hrs to fix

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

                                            case "locative": # jatıs
                                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                    if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                        $word .= "те";
                                                    } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                Severity: Major
                                Found in includes/languages/LanguageKk_cyrl.php and 1 other location - About 2 hrs to fix
                                includes/languages/LanguageKk_cyrl.php on lines 96..110

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

                                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 ( $params['startsortkeyprefix'] !== null ) {
                                                    $startsortkey = $this->collation->getSortKey( $params['startsortkeyprefix'] );
                                                } elseif ( $params['starthexsortkey'] !== null ) {
                                                    if ( !$this->validateHexSortkey( $params['starthexsortkey'] ) ) {
                                                        $encParamName = $this->encodeParamName( 'starthexsortkey' );
                                Severity: Major
                                Found in includes/api/ApiQueryCategoryMembers.php and 1 other location - About 2 hrs to fix
                                includes/api/ApiQueryCategoryMembers.php on lines 174..184

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

                                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 "possessive locative": # täweldık + jatıs
                                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
                                                    if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                        $word .= "де";
                                                    } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                Severity: Major
                                Found in includes/languages/LanguageKk_cyrl.php and 1 other location - About 2 hrs to fix
                                includes/languages/LanguageKk_cyrl.php on lines 232..246

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

                                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 "dative": # barıs
                                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                    if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                        $word .= "ке";
                                                    } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                Severity: Major
                                Found in includes/languages/LanguageKk_cyrl.php and 1 other location - About 2 hrs to fix
                                includes/languages/LanguageKk_cyrl.php on lines 172..186

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

                                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 "possessive ablative": # täweldık + şığıs
                                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
                                                    if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                        $word .= "нен";
                                                    } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                Severity: Major
                                Found in includes/languages/LanguageKk_cyrl.php and 1 other location - About 2 hrs to fix
                                includes/languages/LanguageKk_cyrl.php on lines 189..203

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

                                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