wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Method unflattenCLDRPlurals has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function unflattenCLDRPlurals( string $key, string $message ) {
        // Quick escape.
        if ( !str_contains( $message, '{{PLURAL' ) ) {
            return false;
        }
Severity: Major
Found in src/MessageProcessing/ArrayFlattener.php - About 2 hrs to fix

    File ValidationRunner.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Message validation framework.
     *
     * @file
    Severity: Minor
    Found in src/Validation/ValidationRunner.php - About 2 hrs to fix

      Function listen has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              listen: function () {
                  var groupSelector = this;
      
                  // Hide the selector panel when clicking outside of it
                  $( document.documentElement ).on( 'click', this.hide.bind( this ) );
      Severity: Minor
      Found in resources/src/ext.translate.groupselector/index.js - About 2 hrs to fix

        Method run has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function run(): bool {
                // WARNING: Nothing here must not depend on message index being up to date.
                // For performance reasons, message index rebuild is run a separate job after
                // everything else is updated.
        
        
        Severity: Minor
        Found in src/PageTranslation/UpdateTranslatablePageJob.php - About 2 hrs to fix

          Method fullTable has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function fullTable(): string {
                  $modules = [];
                  Services::getInstance()->getHookRunner()->onTranslateBeforeAddModules( $modules );
                  $this->getOutput()->addModules( $modules );
          
          
          Severity: Minor
          Found in src/TranslatorInterface/MessageTable.php - About 2 hrs to fix

            Method factory has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function factory( string $serviceName, array $config ): ?TranslationWebService {
                    $handlers = [
                        'microsoft' => [
                            'class' => MicrosoftWebService::class,
                            'deps' => [ 'HttpRequestFactory' ]
            Severity: Minor
            Found in src/WebService/TranslationWebService.php - About 2 hrs to fix

              Method makeList has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function makeList(): string {
                      $items = [];
                      $requests = [];
                      $users = $this->translateSandbox->getUsers();
              
              
              Severity: Minor
              Found in src/TranslatorSandbox/ManageTranslatorSandboxSpecialPage.php - About 2 hrs to fix

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

                    public function execute() {
                        $mwServices = MediaWikiServices::getInstance();
                        $config = $mwServices->getMainConfig();
                
                        if ( !$config->get( 'TranslateGroupSynchronizationCache' ) ) {
                Severity: Minor
                Found in src/Synchronization/CompleteExternalTranslationMaintenanceScript.php - About 2 hrs to fix

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

                          } else if (position === 'left') {
                              borderValue = alignBorderValue(me.right);
                              tx1 = me.right - tl;
                              tx2 = borderValue - axisHalfWidth;
                              x1 = alignBorderValue(chartArea.left) + axisHalfWidth;
                  Severity: Major
                  Found in resources/lib/Chart.js/Chart.js and 1 other location - About 2 hrs to fix
                  resources/lib/Chart.js/Chart.js on lines 12143..12167

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

                  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

                  Method formatMessageBlock has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function formatMessageBlock(
                          string $key,
                          Message $message,
                          array $trans,
                          array $pot,
                  Severity: Minor
                  Found in src/FileFormatSupport/GettextFormat.php - About 2 hrs to fix

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

                            if (position === 'top') {
                                borderValue = alignBorderValue(me.bottom);
                                ty1 = me.bottom - tl;
                                ty2 = borderValue - axisHalfWidth;
                                y1 = alignBorderValue(chartArea.top) + axisHalfWidth;
                    Severity: Major
                    Found in resources/lib/Chart.js/Chart.js and 1 other location - About 2 hrs to fix
                    resources/lib/Chart.js/Chart.js on lines 12155..12167

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

                    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

                    Method getIssues has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
                            $issues = new ValidationIssues();
                    
                            $definition = $message->definition();
                            $translation = $message->translation();
                    Severity: Minor
                    Found in src/Validation/Validators/MediaWikiTimeListValidator.php - About 2 hrs to fix

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

                                          } else {
                                              $children.addClass( 'statstable-hide' ).trigger( 'hide' );
                                              doZebra( $table );
                                              $el.addClass( 'collapsed' ).removeClass( 'expanded' );
                                              $el.find( '> a' ).text( mw.msg( 'translate-langstats-expand' ) );
                      Severity: Major
                      Found in resources/src/ext.translate.special.languagestats/index.js and 1 other location - About 2 hrs to fix
                      resources/src/ext.translate.special.languagestats/index.js on lines 54..59

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

                      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 ( $el.hasClass( 'collapsed' ) ) {
                                              $children.removeClass( 'statstable-hide' ).trigger( 'show' );
                                              doZebra( $table );
                                              $el.removeClass( 'collapsed' ).addClass( 'expanded' );
                                              $el.find( '> a' ).text( mw.msg( 'translate-langstats-collapse' ) );
                      Severity: Major
                      Found in resources/src/ext.translate.special.languagestats/index.js and 1 other location - About 2 hrs to fix
                      resources/src/ext.translate.special.languagestats/index.js on lines 59..64

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

                      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 formatMessageGently has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              formatMessageGently: function ( text, key ) {
                                  var protocols = mw.config.get( 'wgUrlProtocols' );
                      
                                  // Try to keep simple.
                                  text = $( '<div>' ).text( text ).html();
                      Severity: Minor
                      Found in resources/js/ext.translate.parsers.js - About 1 hr to fix

                        Function drawBody has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            drawBody: function(pt, vm, ctx) {
                                var bodyFontSize = vm.bodyFontSize;
                                var bodySpacing = vm.bodySpacing;
                                var bodyAlign = vm._bodyAlign;
                                var body = vm.body;
                        Severity: Minor
                        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                          Function showMessageDocumentation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  showMessageDocumentation: function ( documentation ) {
                                      if ( !mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
                                          return;
                                      }
                          
                          
                          Severity: Minor
                          Found in resources/js/ext.translate.editor.helpers.js - About 1 hr to fix

                            Method getTextForRendering has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getTextForRendering(
                                    ?Message $msg,
                                    Language $sourceLanguage,
                                    Language $targetLanguage,
                                    bool $wrapUntranslated,
                            Severity: Minor
                            Found in src/PageTranslation/TranslationUnit.php - About 1 hr to fix

                              Function generateTicks has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function generateTicks(generationOptions, dataRange) {
                                  var ticks = [];
                                  // To get a "nice" value for the tick spacing, we will use the appropriately named
                                  // "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
                                  // for details.
                              Severity: Minor
                              Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

                                    public function execute() {
                                        global $wgSitename, $wgTranslateMessageNamespaces;
                                
                                        $days = (int)$this->getOption( 'days', 30 );
                                        $top = (int)$this->getOption( 'top', -1 );
                                Severity: Minor
                                Found in scripts/characterEditStats.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language