wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

File ElasticSearchTtmServer.php has 519 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
declare( strict_types = 1 );

namespace MediaWiki\Extension\Translate\TtmServer;

Severity: Major
Found in src/TtmServer/ElasticSearchTtmServer.php - About 1 day to fix

    File SearchTranslationsSpecialPage.php has 518 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    declare( strict_types = 1 );
    
    namespace MediaWiki\Extension\Translate\TtmServer;
    
    
    Severity: Major
    Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 1 day to fix

      File GettextFormat.php has 512 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      declare( strict_types = 1 );
      
      namespace MediaWiki\Extension\Translate\FileFormatSupport;
      
      
      Severity: Major
      Found in src/FileFormatSupport/GettextFormat.php - About 1 day to fix

        File groupStatistics.php has 502 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Commandline script to general statistics about the localisation level of
         * one or more message groups.
         *
        Severity: Major
        Found in scripts/groupStatistics.php - About 1 day to fix

          File ext.translate.special.translate.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          ( function () {
              'use strict';
          
              var state, hideOptionalMessages = '!optional';
          
          
          Severity: Minor
          Found in resources/js/ext.translate.special.translate.js - About 1 day to fix

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

                public function execute( $subPage ) {
                    $this->setHeaders();
                    $this->checkPermissions();
            
                    $server = $this->ttmServerFactory->getDefaultForQuerying();
            Severity: Major
            Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 7 hrs to fix

              Method showPage has 186 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function showPage( TranslatablePageMarkOperation $operation ): void {
                      $page = $operation->getPage();
                      $out = $this->getOutput();
                      $out->addWikiMsg( 'tpt-showpage-intro' );
              
              
              Severity: Major
              Found in src/PageTranslation/PageTranslationSpecialPage.php - About 7 hrs to fix

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

                    public function execute(): void {
                        $this->checkUserRightsAny( self::$right );
                        $block = $this->getUser()->getBlock();
                        if ( $block && $block->isSitewide() ) {
                            $this->dieBlocked( $block );
                Severity: Major
                Found in src/MessageGroupProcessing/AggregateGroupsActionApi.php - About 6 hrs to fix

                  File ServiceWiring.php has 456 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * List of services in this extension with construction instructions.
                   *
                   * @file
                  Severity: Minor
                  Found in src/ServiceWiring.php - About 6 hrs to fix

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

                        public function execute() {
                            $logger = LoggerFactory::getInstance( 'Translate.GroupSynchronization' );
                            $groupPattern = $this->getOption( 'group' ) ?? '';
                            $groupSkipPattern = $this->getOption( 'skipgroup' ) ?? '';
                            $skipGroupSyncCheck = $this->hasOption( 'skip-group-sync-check' );
                    Severity: Major
                    Found in src/Synchronization/ExportTranslationsMaintenanceScript.php - About 6 hrs to fix

                      Services has 46 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Services implements ContainerInterface {
                          private ContainerInterface $container;
                      
                          private function __construct( ContainerInterface $container ) {
                              $this->container = $container;
                      Severity: Minor
                      Found in src/Services.php - About 6 hrs to fix

                        File MessageGroupStats.php has 429 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        declare( strict_types = 1 );
                        
                        namespace MediaWiki\Extension\Translate\Statistics;
                        
                        
                        Severity: Minor
                        Found in src/Statistics/MessageGroupStats.php - About 6 hrs to fix

                          Function handleFuzzy has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function handleFuzzy( Title $title, bool $invalidate, PageUpdater $updater, int $baseTranver ): void {
                                  global $wgTranslateDocumentationLanguageCode;
                                  $editResult = $updater->getEditResult();
                                  if ( !$invalidate && !$editResult->isExactRevert() ) {
                                      return;
                          Severity: Minor
                          Found in src/Synchronization/UpdateMessageJob.php - About 6 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          MessageCollection has 44 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class MessageCollection implements ArrayAccess, Iterator, Countable {
                              /**
                               * The queries can get very large because each message title is specified
                               * individually. Very large queries can confuse the database query planner.
                               * Queries are split into multiple separate queries having at most this many
                          Severity: Minor
                          Found in src/MessageLoading/MessageCollection.php - About 6 hrs to fix

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

                                public function execute( array $messages ): bool {
                                    $context = RequestContext::getMain();
                                    $output = $context->getOutput();
                            
                                    // Set up diff engine
                            Severity: Major
                            Found in src/Synchronization/MessageWebImporter.php - About 5 hrs to fix

                              File index.js has 414 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              ( function () {
                                  'use strict';
                              
                                  var groupsLoader, delay;
                              
                              
                              Severity: Minor
                              Found in resources/src/ext.translate.groupselector/index.js - About 5 hrs to fix

                                Function parseFile has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function parseFile(): array {
                                        $defines = file_get_contents( $this->definitionFile );
                                        $linefeed = '(\r\n|\n)';
                                        $sections = array_map(
                                            'trim',
                                Severity: Minor
                                Found in src/MessageGroupConfiguration/PremadeMediaWikiExtensionGroups.php - About 5 hrs to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                File MessageGroups.php has 413 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                declare( strict_types = 1 );
                                
                                namespace MediaWiki\Extension\Translate\MessageGroupProcessing;
                                
                                
                                Severity: Minor
                                Found in src/MessageGroupProcessing/MessageGroups.php - About 5 hrs to fix

                                  File TranslatablePageMarker.php has 408 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  declare( strict_types = 1 );
                                  
                                  namespace MediaWiki\Extension\Translate\PageTranslation;
                                  
                                  
                                  Severity: Minor
                                  Found in src/PageTranslation/TranslatablePageMarker.php - About 5 hrs to fix

                                    Function run has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        private function run( ApiPageSet $resultPageSet = null ): void {
                                            $params = $this->extractRequestParams();
                                    
                                            $group = MessageGroups::getGroup( $params['group'] );
                                            if ( !$group ) {
                                    Severity: Minor
                                    Found in src/MessageLoading/QueryMessageCollectionActionApi.php - About 5 hrs to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language