wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Method write has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function write( MessageCollection $collection ): void {
        $writePath = $this->writePath;

        if ( $writePath === null ) {
            throw new LogicException( 'Write path is not set. Set write path before calling write()' );
Severity: Minor
Found in src/FileFormatSupport/SimpleFormat.php - About 1 hr to fix

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

        this.messageLabel = new OO.ui.MenuOptionWidget( {
            label: mw.msg( 'translate-tes-optgroup-message' ),
            disabled: true,
            highlightable: false,
            pressable: false,
    Severity: Major
    Found in resources/src/ext.translate.entity.selector/index.js and 1 other location - About 1 hr to fix
    resources/src/ext.translate.entity.selector/index.js on lines 48..54

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

    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

            autosize.update = function ( el ) {
                if ( el ) {
                    Array.prototype.forEach.call( el.length ? el : [ el ], update );
                }
                return el;
    Severity: Major
    Found in resources/lib/jquery.autosize.js and 1 other location - About 1 hr to fix
    resources/lib/jquery.autosize.js on lines 272..277

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

    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 30 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/MediaWikiLinkValidator.php - About 1 hr to fix

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

          this.groupLabel = new OO.ui.MenuOptionWidget( {
              label: mw.msg( 'translate-tes-optgroup-group' ),
              disabled: true,
              highlightable: false,
              pressable: false,
      Severity: Major
      Found in resources/src/ext.translate.entity.selector/index.js and 1 other location - About 1 hr to fix
      resources/src/ext.translate.entity.selector/index.js on lines 40..46

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

      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

              autosize.destroy = function ( el ) {
                  if ( el ) {
                      Array.prototype.forEach.call( el.length ? el : [ el ], destroy );
                  }
                  return el;
      Severity: Major
      Found in resources/lib/jquery.autosize.js and 1 other location - About 1 hr to fix
      resources/lib/jquery.autosize.js on lines 278..283

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

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

          update: function(reset) {
              var me = this;
              var meta = me.getMeta();
              var line = meta.dataset;
              var points = meta.data || [];
      Severity: Minor
      Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

        Function getAxesLabelsAndData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function getAxesLabelsAndData( jsonGraphData ) {
                    var labels = [], graphData = [],
                        labelIndex = 0,
                        maxValue = 0, minValue = 0;
        
        
        Severity: Minor
        Found in resources/js/ext.translate.translationstats.graphbuilder.js - About 1 hr to fix

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

                  listen: function () {
                      var messageTable = this,
                          $filterInput = this.$container.parent().find( '.tux-message-filter-box' );
          
                      // Vector has transitions of 250ms which affect layout. Let those finish.
          Severity: Minor
          Found in resources/js/ext.translate.messagetable.js - About 1 hr to fix

            Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    init: function () {
                        var that = this;
            
                        this.render();
            
            
            Severity: Minor
            Found in resources/js/ext.translate.proofread.js - About 1 hr to fix

              Function showAssistantLanguages has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      showAssistantLanguages: function ( translations ) {
                          if ( translations.error ) {
                              return;
                          }
              
              
              Severity: Minor
              Found in resources/js/ext.translate.editor.helpers.js - About 1 hr to fix

                Function listenArrayEvents has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function listenArrayEvents(array, listener) {
                    if (array._chartjs) {
                        array._chartjs.listeners.push(listener);
                        return;
                    }
                Severity: Minor
                Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                  Function getFuzzyTimestamp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function getFuzzyTimestamp( pageTitle ) {
                          var api = new mw.Api();
                  
                          // This api call returns the timestamp of FuzzyBot's edit
                          return api.get( {
                  Severity: Minor
                  Found in resources/js/ext.translate.special.pagemigration.js - About 1 hr to fix

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

                        public function __construct() {
                            parent::__construct();
                            $this->addDescription( 'Script to bootstrap TtmServer.' );
                            $this->addOption(
                                'threads',
                    Severity: Minor
                    Found in scripts/ttmserver-export.php - About 1 hr to fix

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

                          public function execute() {
                              $mwLanguages = $this->loadMediaWiki();
                              $gtLanguages = $this->loadGettext();
                              $clLanguages = $this->loadCLDR();
                      
                      
                      Severity: Minor
                      Found in scripts/plural-comparison.php - About 1 hr to fix

                        Function calculateTickRotation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            calculateTickRotation: function() {
                                var me = this;
                                var options = me.options;
                                var tickOpts = options.ticks;
                                var numTicks = me.getTicks().length;
                        Severity: Minor
                        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                          Method needsFuzzy has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function needsFuzzy( string $text ): bool {
                                  // Docs are exempt for checks
                                  if ( $this->isDoc() ) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in src/MessageLoading/MessageHandle.php - About 1 hr to fix

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

                                private function getCommonFormFields(): array {
                                    $dropdownOptions = $this->msg( 'deletereason-dropdown' )->inContentLanguage()->text();
                            
                                    $options = Xml::listDropdownOptions(
                                        $dropdownOptions,
                            Severity: Minor
                            Found in src/PageTranslation/DeleteTranslatableBundleSpecialPage.php - About 1 hr to fix

                              Method getQuery has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function getQuery( string $text, string $sourceLanguage, string $targetLanguage ): TranslationQuery {
                                      if ( !isset( $this->config['key'] ) ) {
                                          throw new TranslationWebServiceConfigurationException( 'key is not set' );
                                      }
                              
                              
                              Severity: Minor
                              Found in src/WebService/MicrosoftWebService.php - About 1 hr to fix

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

                                    public function execute( $par ) {
                                        $this->setHeaders();
                                        $this->outputHeader();
                                
                                        $out = $this->getOutput();
                                Severity: Minor
                                Found in src/TranslatorInterface/TranslationsSpecialPage.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language