wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function draw has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    draw: function() {
        var ctx = this._chart.ctx;
        var vm = this._view;

        if (vm.opacity === 0) {
Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Function roundedRect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        roundedRect: function(ctx, x, y, width, height, radius) {
            if (radius) {
                var r = Math.min(radius, height / 2, width / 2);
                var left = x + r;
                var top = y + r;
    Severity: Minor
    Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

      Function onShowTranslationMemorySources has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              onShowTranslationMemorySources: function ( e, suggestion ) {
                  e.stopPropagation();
      
                  if ( suggestion.$sourcesElement ) {
                      suggestion.$sourcesElement.toggleClass( 'hide' );
      Severity: Minor
      Found in resources/js/ext.translate.editor.helpers.js - About 1 hr to fix

        Function eventHandler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            eventHandler: function(e) {
                var me = this;
                var tooltip = me.tooltip;
        
                if (core_plugins.notify(me, 'beforeEvent', [e]) === false) {
        Severity: Minor
        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

          Method showTitles has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function showTitles( array $messageGroupsIds ): string {
                  if ( count( $messageGroupsIds ) >= 100 ) {
                      return $this->msg( 'tpt-manage-message-group-subscriptions-too-many' )->parse();
                  }
          
          
          Severity: Minor
          Found in src/PageTranslation/ManageMessageGroupSubscriptionsSpecialPage.php - About 1 hr to fix

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

                public function execute() {
                    $dbw = $this->getDB( DB_PRIMARY );
            
                    if ( !$dbw->tableExists( 'revtag', __METHOD__ ) ) {
                        $this->fatalError( "Table revtag doesn't exist. Translate extension is not installed?" );
            Severity: Minor
            Found in scripts/migrate-schema2.php - About 1 hr to fix

              Method translatablePageHeader has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function translatablePageHeader( $article, &$outputDone, &$pcache ) {
                      if ( $article->getOldID() ) {
                          return;
                      }
              
              
              Severity: Minor
              Found in src/PageTranslation/Hooks.php - About 1 hr to fix

                Method isValid has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function isValid(): bool {
                        static $jobHasBeenScheduled = false;
                
                        if ( !$this->isMessageNamespace() ) {
                            return false;
                Severity: Minor
                Found in src/MessageLoading/MessageHandle.php - About 1 hr to fix

                  Method getNewTitle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getNewTitle( Title $title ): Title {
                          $instructions = $this->map[$title->getNamespace()] ?? null;
                          if ( $instructions === null ) {
                              throw new InvalidPageTitleRename(
                                  'Trying to move a page which is not part of the translatable page', self::UNKNOWN_PAGE
                  Severity: Minor
                  Found in src/PageTranslation/PageTitleRenamer.php - About 1 hr to fix

                    Method handleModificationsSubmit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function handleModificationsSubmit(
                            MessageGroup $group,
                            MessageSourceChange $sourceChanges,
                            WebRequest $req,
                            string $language,
                    Severity: Minor
                    Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

                      Method populateQueries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function populateQueries(): void {
                              $definition = $this->dataProvider->getDefinition();
                              $translations = $this->dataProvider->getGoodTranslations();
                              $sourceLanguage = $this->group->getSourceLanguage();
                              $targetLanguage = $this->handle->getCode();
                      Severity: Minor
                      Found in src/TranslatorInterface/Aid/MachineTranslationAid.php - About 1 hr to fix

                        Method markAsResolved has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function markAsResolved( string $groupId, ?string $messageTitle = null ): void {
                                if ( $messageTitle === null ) {
                                    $currentGroupStatus = $this->groupSyncCache->markGroupAsResolved( $groupId );
                                    $this->groupSyncLog->info(
                                        '{user} resolved group {groupId}.',
                        Severity: Minor
                        Found in src/Synchronization/ManageGroupSynchronizationCacheActionApi.php - About 1 hr to fix

                          Method inLanguage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function inLanguage( string $code ): array {
                                  $dbr = $this->loadBalancer->getConnection( DB_REPLICA, 'vslow' );
                          
                                  $res = $dbr->newSelectQueryBuilder()
                                      ->select( [
                          Severity: Minor
                          Found in src/Statistics/TranslatorActivityQuery.php - About 1 hr to fix

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

                                protected function getAllowedParams(): array {
                                    return [
                                        'groupId' => [
                                            ParamValidator::PARAM_TYPE => 'string',
                                            ParamValidator::PARAM_REQUIRED => true,
                            Severity: Minor
                            Found in src/MessageGroupProcessing/ManageMessageGroupsActionApi.php - About 1 hr to fix

                              Method isTranslatableMessage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function isTranslatableMessage( MessageHandle $handle, string $targetLanguage ): bool {
                                      static $cache = [];
                              
                                      if ( !$handle->isValid() ) {
                                          return false;
                              Severity: Minor
                              Found in src/MessageGroupProcessing/MessageGroups.php - About 1 hr to fix

                                Method writeReal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function writeReal( MessageCollection $collection ): string {
                                        $header = $this->doHeader( $collection );
                                        $header .= $this->doAuthors( $collection );
                                        $header .= "\n";
                                
                                
                                Severity: Minor
                                Found in src/FileFormatSupport/AppleFormat.php - About 1 hr to fix

                                  Method writeReal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function writeReal( MessageCollection $collection ): string {
                                          $output = '';
                                          $mangler = $this->group->getMangler();
                                  
                                          /** @var Message $m */
                                  Severity: Minor
                                  Found in src/FileFormatSupport/IniFormat.php - About 1 hr to fix

                                    Method writeReal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function writeReal( MessageCollection $collection ): string {
                                            $output = $this->doHeader( $collection );
                                            $output .= $this->doAuthors( $collection );
                                    
                                            $mangler = $this->group->getMangler();
                                    Severity: Minor
                                    Found in src/FileFormatSupport/YamlFormat.php - About 1 hr to fix

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

                                      $specialPageAliases['gsw'] = [
                                          'ImportTranslations' => [ 'Übersetzige_importiere' ],
                                          'LanguageStats' => [ 'Sprochstatischtik' ],
                                          'ManageMessageGroups' => [ 'Noochrichtegruppe_verwalte' ],
                                          'MessageGroupStats' => [ 'Noochrichtegruppestatistike' ],
                                      Severity: Major
                                      Found in Translate.alias.php and 3 other locations - About 1 hr to fix
                                      Translate.alias.php on lines 504..515
                                      Translate.alias.php on lines 689..700
                                      Translate.alias.php on lines 902..913

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

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

                                      $specialPageAliases['scn'] = [
                                          'AggregateGroups' => [ 'GruppiAggregati' ],
                                          'ImportTranslations' => [ 'ImportaTraduzioni' ],
                                          'LanguageStats' => [ 'StatisticheLingua' ],
                                          'ManageMessageGroups' => [ 'GestisciGruppiMessaggio' ],
                                      Severity: Major
                                      Found in Translate.alias.php and 3 other locations - About 1 hr to fix
                                      Translate.alias.php on lines 428..439
                                      Translate.alias.php on lines 504..515
                                      Translate.alias.php on lines 689..700

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

                                      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