wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function update has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    update: function(config) {
        var me = this;
        var i, ilen;

        if (!config || typeof config !== 'object') {
Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Method submitRaw has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function submitRaw( array $data ): bool {
            $retainedLines = trim( $data['Titles'] );
            $retainedGroups = $retainedLines ? array_map( 'trim', explode( "\n", $retainedLines ) ) : [];
            $current = $this->messageGroupSubscription->getUserSubscriptions( $this->getUser() );
    
    
    Severity: Minor
    Found in src/PageTranslation/ManageMessageGroupSubscriptionsSpecialPage.php - About 1 hr to fix

      Method getCommonFormFields has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getCommonFormFields(): array {
              return [
                  'wpOldTitle' => [
                      'type' => 'text',
                      'name' => 'wpOldTitle',
      Severity: Minor
      Found in src/PageTranslation/MoveTranslatableBundleSpecialPage.php - About 1 hr to fix

        Method preventDirectEditing has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function preventDirectEditing( Title $title, User $user, $action, &$result ) {
                if ( self::$allowTargetEdit ) {
                    return true;
                }
        
        
        Severity: Minor
        Found in src/PageTranslation/Hooks.php - About 1 hr to fix

          Method hasCacheEntry has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function hasCacheEntry(
                  MessageGroupCache $cache,
                  MessageCollection $collection,
                  string $messageKey
              ): bool {
          Severity: Minor
          Found in src/Synchronization/ExternalMessageSourceStateComparator.php - About 1 hr to fix

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

                public function execute() {
                    $this->checkUserRightsAny( self::RIGHT );
                    $block = $this->getUser()->getBlock();
                    if ( $block && $block->isSitewide() ) {
                        $this->dieBlocked( $block );
            Severity: Minor
            Found in src/Synchronization/ManageGroupSynchronizationCacheActionApi.php - About 1 hr to fix

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

                  public function __construct() {
                      parent::__construct();
                      $this->addDescription( 'Script for processing message changes in file based message groups' );
                      $this->addOption(
                          'group',
              Severity: Minor
              Found in src/Synchronization/ImportExternalTranslationsMaintenanceScript.php - About 1 hr to fix

                Method onBeforeCreateEchoEvent has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function onBeforeCreateEchoEvent(
                        array &$notifications,
                        array &$notificationCategories,
                        array &$notificationIcons
                    ) {
                Severity: Minor
                Found in src/MessageGroupProcessing/MessageGroupSubscriptionHookHandler.php - About 1 hr to fix

                  Method addForm has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function addForm(): void {
                          $formDescriptor = [
                              'language' => [
                                  'type' => 'text',
                                  'name' => 'language',
                  Severity: Minor
                  Found in src/Statistics/LanguageStatsSpecialPage.php - About 1 hr to fix

                    Method getTranslatableLanguages has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getTranslatableLanguages() {
                            $groupConfiguration = $this->getConfiguration();
                            if ( !isset( $groupConfiguration['LANGUAGES'] ) ) {
                                // No LANGUAGES section in the configuration.
                                return null;
                    Severity: Minor
                    Found in messagegroups/MessageGroupBase.php - About 1 hr to fix

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

                          private function getMessageErrorKey( string $groupId, string ...$messages ): array {
                              $messageKeys = [];
                              foreach ( $messages as $message ) {
                                  $key = $groupId . '_' . $message;
                                  $hash = substr( hash( 'sha256', $key ), 0, 40 );
                      Severity: Major
                      Found in src/Synchronization/GroupSynchronizationCache.php and 1 other location - About 1 hr to fix
                      src/Synchronization/GroupSynchronizationCache.php on lines 465..475

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

                      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

                      $specialPageAliases['nb'] = [
                          'AggregateGroups' => [ 'Samlingsgrupper' ],
                          'ImportTranslations' => [ 'Importer_oversettelser' ],
                          'LanguageStats' => [ 'Språkstatistikk' ],
                          'ManageMessageGroups' => [ 'Behandle_meldingsgrupper' ],
                      Severity: Major
                      Found in Translate.alias.php and 2 other locations - About 1 hr to fix
                      Translate.alias.php on lines 537..549
                      Translate.alias.php on lines 825..837

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

                      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

                      $specialPageAliases['it'] = [
                          'AggregateGroups' => [ 'GruppiAggregati' ],
                          'ImportTranslations' => [ 'ImportaTraduzioni' ],
                          'LanguageStats' => [ 'StatisticheLingua' ],
                          'ManageMessageGroups' => [ 'GestisciGruppiMessaggio' ],
                      Severity: Major
                      Found in Translate.alias.php and 2 other locations - About 1 hr to fix
                      Translate.alias.php on lines 747..759
                      Translate.alias.php on lines 825..837

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

                      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

                      $specialPageAliases['pl'] = [
                          'AggregateGroups' => [ 'Grupy_zbiorcze' ],
                          'ImportTranslations' => [ 'Import_tłumaczeń' ],
                          'LanguageStats' => [ 'Statystyka_językowa' ],
                          'ManageMessageGroups' => [ 'Zarządzanie_grupami_komunikatów' ],
                      Severity: Major
                      Found in Translate.alias.php and 2 other locations - About 1 hr to fix
                      Translate.alias.php on lines 537..549
                      Translate.alias.php on lines 747..759

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

                      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

                          private function getMessageKeys( string $groupId, string ...$messages ): array {
                              $messageKeys = [];
                              foreach ( $messages as $message ) {
                                  $key = $groupId . '_' . $message;
                                  $hash = substr( hash( 'sha256', $key ), 0, 40 );
                      Severity: Major
                      Found in src/Synchronization/GroupSynchronizationCache.php and 1 other location - About 1 hr to fix
                      src/Synchronization/GroupSynchronizationCache.php on lines 483..493

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

                      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

                          if ( options.at[ 1 ] === 'bottom' ) {
                              basePosition.top += targetHeight;
                          } else if ( options.at[ 1 ] === 'center' ) {
                              basePosition.top += targetHeight / 2;
                          }
                      Severity: Major
                      Found in resources/src/ext.translate.groupselector/ui.position.js and 3 other locations - About 1 hr to fix
                      resources/src/ext.translate.groupselector/ui.position.js on lines 260..264
                      resources/src/ext.translate.groupselector/ui.position.js on lines 290..294
                      resources/src/ext.translate.groupselector/ui.position.js on lines 296..300

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

                      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

                          if ( options.at[ 0 ] === 'right' ) {
                              basePosition.left += targetWidth;
                          } else if ( options.at[ 0 ] === 'center' ) {
                              basePosition.left += targetWidth / 2;
                          }
                      Severity: Major
                      Found in resources/src/ext.translate.groupselector/ui.position.js and 3 other locations - About 1 hr to fix
                      resources/src/ext.translate.groupselector/ui.position.js on lines 266..270
                      resources/src/ext.translate.groupselector/ui.position.js on lines 290..294
                      resources/src/ext.translate.groupselector/ui.position.js on lines 296..300

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

                      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

                              if ( options.my[ 0 ] === 'right' ) {
                                  position.left -= elemWidth;
                              } else if ( options.my[ 0 ] === 'center' ) {
                                  position.left -= elemWidth / 2;
                              }
                      Severity: Major
                      Found in resources/src/ext.translate.groupselector/ui.position.js and 3 other locations - About 1 hr to fix
                      resources/src/ext.translate.groupselector/ui.position.js on lines 260..264
                      resources/src/ext.translate.groupselector/ui.position.js on lines 266..270
                      resources/src/ext.translate.groupselector/ui.position.js on lines 296..300

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

                      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

                              if ( options.my[ 1 ] === 'bottom' ) {
                                  position.top -= elemHeight;
                              } else if ( options.my[ 1 ] === 'center' ) {
                                  position.top -= elemHeight / 2;
                              }
                      Severity: Major
                      Found in resources/src/ext.translate.groupselector/ui.position.js and 3 other locations - About 1 hr to fix
                      resources/src/ext.translate.groupselector/ui.position.js on lines 260..264
                      resources/src/ext.translate.groupselector/ui.position.js on lines 266..270
                      resources/src/ext.translate.groupselector/ui.position.js on lines 290..294

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

                      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

                      Function drawBackground has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          drawBackground: function(pt, vm, ctx, tooltipSize) {
                              ctx.fillStyle = vm.backgroundColor;
                              ctx.strokeStyle = vm.borderColor;
                              ctx.lineWidth = vm.borderWidth;
                              var xAlign = vm.xAlign;
                      Severity: Minor
                      Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language