wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function drawLegendBox has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var drawLegendBox = function(x, y, legendItem) {
            if (isNaN(boxWidth) || boxWidth <= 0) {
                return;
            }

Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Method isSourcePage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function isSourcePage( PageIdentity $page ): bool {
            if ( !$page->exists() ) {
                // No point in loading all translatable pages if the page
                // doesn’t exist. This also avoids PreconditionExceptions
                // if $page is a Title pointing to a non-proper page like
    Severity: Minor
    Found in src/PageTranslation/TranslatablePage.php - About 1 hr to fix

      Method getDocumentationBox has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getDocumentationBox(): string {
              global $wgTranslateDocumentationLanguageCode;
      
              if ( !$wgTranslateDocumentationLanguageCode ) {
                  throw new TranslationHelperException( 'Message documentation language code is not defined' );
      Severity: Minor
      Found in src/TranslatorInterface/LegacyTranslationAids.php - About 1 hr to fix

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

            public function execute( $parameters ) {
                $out = $this->getOutput();
                $out->addModuleStyles( [
                    'ext.translate.special.translate.styles',
                    'jquery.uls.grid',
        Severity: Minor
        Found in src/TranslatorInterface/TranslateSpecialPage.php - About 1 hr to fix

          Method onMovePageTranslationUnits has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function onMovePageTranslationUnits(
                  LinkTarget $oldLinkTarget,
                  LinkTarget $newLinkTarget,
                  UserIdentity $userIdentity,
                  int $oldid,
          Severity: Minor
          Found in src/PageTranslation/Hooks.php - About 1 hr to fix

            Method doReview has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function doReview( User $user, RevisionRecord $revRecord ): bool {
                    $dbw = $this->loadBalancer->getConnection( DB_PRIMARY );
                    $dbw->newInsertQueryBuilder()
                        ->insertInto( 'translate_reviews' )
                        ->ignore()
            Severity: Minor
            Found in src/TranslatorInterface/ReviewTranslationActionApi.php - About 1 hr to fix

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

                  public function __construct() {
                      parent::__construct();
                      $this->addDescription( 'Creates a dump file that can be imported to a TtmServer' );
              
                      $this->addOption(
              Severity: Minor
              Found in src/TtmServer/ExportTtmServerDumpMaintenanceScript.php - About 1 hr to fix

                Method formatWebSuggestions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function formatWebSuggestions( array $queryData ): array {
                        $service = $queryData['service'];
                        $response = $queryData['response'];
                        $sourceLanguage = $queryData['language'];
                        $sourceText = $queryData['text'];
                Severity: Minor
                Found in src/TranslatorInterface/Aid/TTMServerAid.php - About 1 hr to fix

                  Method query has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function query( string $sourceLanguage, string $targetLanguage, string $text ): array {
                          // Calculate the bounds of the string length which are able
                          // to satisfy the cutoff percentage in edit distance.
                          $len = mb_strlen( $text );
                          $min = ceil( max( $len * $this->config['cutoff'], 2 ) );
                  Severity: Minor
                  Found in src/TtmServer/DatabaseTtmServer.php - About 1 hr to fix

                    Method getHopefullyValidConfigurations has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getHopefullyValidConfigurations( string $data, ?callable $callback = null ): array {
                            if ( !is_callable( $callback ) ) {
                                $callback = static function ( $unused1, $unused2, $unused3 ) {
                                    /*noop*/
                                };
                    Severity: Minor
                    Found in src/MessageGroupConfiguration/MessageGroupConfigurationParser.php - About 1 hr to fix

                      Method getGroupErrorInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getGroupErrorInfo( string $groupId ): GroupSynchronizationResponse {
                              $groupMessageErrorTag = $this->getGroupMessageErrorTag( $groupId );
                              $groupMessageEntries = $this->cache->getByTag( $groupMessageErrorTag );
                      
                              $groupErrorKey = $this->getGroupErrorKey( $groupId );
                      Severity: Minor
                      Found in src/Synchronization/GroupSynchronizationCache.php - About 1 hr to fix

                        Method languageCloud has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function languageCloud(): array {
                                $cacheKey = $this->cache->makeKey( 'translate-supportedlanguages-language-cloud', 'v2' );
                        
                                $data = $this->cache->get( $cacheKey );
                                if ( is_array( $data ) ) {
                        Severity: Minor
                        Found in src/Statistics/ActiveLanguagesSpecialPage.php - About 1 hr to fix

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

                              public function execute() {
                                  $params = $this->extractRequestParams();
                          
                                  $target = $this->validateTargetParamater( $params );
                                  $cache = $this->loadStatistics( $target, MessageGroupStats::FLAG_CACHE_ONLY );
                          Severity: Minor
                          Found in src/Statistics/QueryStatsActionApi.php - About 1 hr to fix

                            Method getLanguagesFromHeader has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function getLanguagesFromHeader( array $csvHeader ): Status {
                                    if ( count( $csvHeader ) < 2 ) {
                                        return Status::newFatal(
                                            'CSV has < 2 columns. Assuming that there are no languages to import'
                                        );
                            Severity: Minor
                            Found in src/MessageGroupProcessing/CsvTranslationImporter.php - About 1 hr to fix

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

                                  protected function getAllowedParams(): array {
                                      return [
                                          'do' => [
                                              ParamValidator::PARAM_TYPE => [ 'associate', 'dissociate', 'remove', 'add', 'update' ],
                                              ParamValidator::PARAM_REQUIRED => true,
                              Severity: Minor
                              Found in src/MessageGroupProcessing/AggregateGroupsActionApi.php - About 1 hr to fix

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

                                    public function __construct() {
                                        parent::__construct();
                                        $this->addDescription( 'Import translations for a CSV file' );
                                
                                        $this->addArg(
                                Severity: Minor
                                Found in src/MessageGroupProcessing/ImportTranslationsFromCsv.php - About 1 hr to fix

                                  Method fixMessageParams has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function fixMessageParams( IContextSource $context, array $params ): array {
                                          $out = [];
                                          $lang = $context->getLanguage();
                                  
                                          foreach ( $params as $param ) {
                                  Severity: Minor
                                  Found in src/Validation/ValidationResult.php - About 1 hr to fix

                                    Method pluralFormsCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function pluralFormsCheck(
                                            Message $message, string $code, ValidationIssues $issues
                                        ): void {
                                            $translation = $message->translation();
                                            // Are there any plural forms for this language in this message?
                                    Severity: Minor
                                    Found in src/Validation/Validators/MediaWikiPluralValidator.php - About 1 hr to fix

                                      Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                              MessageIndexStore $store,
                                              WANObjectCache $statusCache,
                                              JobQueueGroup $jobQueueGroup,
                                              HookRunner $hookRunner,
                                              LoggerInterface $logger,
                                      Severity: Major
                                      Found in src/MessageLoading/MessageIndex.php - About 1 hr to fix

                                        Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                                MovePageFactory $movePageFactory,
                                                JobQueueGroup $jobQueue,
                                                LinkBatchFactory $linkBatchFactory,
                                                TranslatableBundleFactory $bundleFactory,
                                                SubpageListBuilder $subpageBuilder,
                                        Severity: Major
                                        Found in src/PageTranslation/TranslatableBundleMover.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language