wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function rgb has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

convert.hwb.rgb = function (hwb) {
    var h = hwb[0] / 360;
    var wh = hwb[1] / 100;
    var bl = hwb[2] / 100;
    var ratio = wh + bl;
Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Function longestText has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        helpers$1.longestText = function(ctx, font, arrayOfThings, cache) {
            cache = cache || {};
            var data = cache.data = cache.data || {};
            var gc = cache.garbageCollect = cache.garbageCollect || [];
    
    
    Severity: Minor
    Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

      Method filterChanged has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function filterChanged( array $keys, bool $condition ): array {
              $this->loadData( $keys );
      
              $origKeys = [];
              if ( !$condition ) {
      Severity: Minor
      Found in src/MessageLoading/MessageCollection.php - About 1 hr to fix

        Method translateTab has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function translateTab( Skin $skin, array &$tabs ) {
                $title = $skin->getTitle();
                $handle = new MessageHandle( $title );
                $code = $handle->getCode();
                $page = TranslatablePage::isTranslationPage( $title );
        Severity: Minor
        Found in src/PageTranslation/Hooks.php - About 1 hr to fix

          Method getOutput has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getOutput( MessageGroup $group ): array {
                  $out = [];
          
                  $groupId = $group->getId();
                  $sourceLanguage = $group->getSourceLanguage();
          Severity: Minor
          Found in src/TtmServer/ExportTtmServerDumpMaintenanceScript.php - About 1 hr to fix

            Method update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function update( MessageHandle $handle, ?string $targetText ): bool {
                    if ( !$handle->isValid() || $handle->getCode() === '' ) {
                        return false;
                    }
            
            
            Severity: Minor
            Found in src/TtmServer/ElasticSearchTtmServer.php - About 1 hr to fix

              Method getTranslationsWithFallback has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getTranslationsWithFallback(
                      MessageBundle $messageBundle,
                      string $languageCode,
                      bool $skipFallbacks
                  ): array {
              Severity: Minor
              Found in src/MessageBundleTranslation/MessageBundleTranslationLoader.php - About 1 hr to fix

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

                    public function __construct() {
                        parent::__construct();
                        $this->addDescription( 'Backport translations from one branch to another.' );
                
                        $this->addOption(
                Severity: Minor
                Found in src/Synchronization/BackportTranslationsMaintenanceScript.php - About 1 hr to fix

                  Method removeFromCache has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function removeFromCache( Title $title ): void {
                          $config = MediaWikiServices::getInstance()->getMainConfig();
                  
                          if ( !$config->get( 'TranslateGroupSynchronizationCache' ) ) {
                              return;
                  Severity: Minor
                  Found in src/Synchronization/UpdateMessageJob.php - About 1 hr to fix

                    Method checkInput has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function checkInput(): Status {
                            $status = Status::newGood();
                    
                            $msgGroup = MessageGroups::getGroup( $this->groupId );
                            if ( $msgGroup === null ) {
                    Severity: Minor
                    Found in src/Synchronization/ExportTranslationsSpecialPage.php - About 1 hr to fix

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

                              var d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2));
                      Severity: Major
                      Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 hr to fix
                      resources/lib/Chart.js/Chart.js on lines 10460..10460

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

                      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

                              var d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2));
                      Severity: Major
                      Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 hr to fix
                      resources/lib/Chart.js/Chart.js on lines 10459..10459

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

                      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

                      function yRange(mouseY) {
                          var vm = this._view;
                          return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;
                      }
                      Severity: Major
                      Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 hr to fix
                      resources/lib/Chart.js/Chart.js on lines 4443..4446

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

                      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

                      function xRange(mouseX) {
                          var vm = this._view;
                          return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;
                      }
                      Severity: Major
                      Found in resources/lib/Chart.js/Chart.js and 1 other location - About 1 hr to fix
                      resources/lib/Chart.js/Chart.js on lines 4448..4451

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

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

                              validateTranslation: function () {
                                  var translateEditor = this,
                                      $textarea = translateEditor.$editor.find( '.tux-textarea-translation' );
                      
                                  var api = new mw.Api();
                      Severity: Minor
                      Found in resources/js/ext.translate.editor.js - About 1 hr to fix

                        Function updateElement has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            updateElement: function(point, index, reset) {
                                var me = this;
                                var meta = me.getMeta();
                                var custom = point.custom || {};
                                var dataset = me.getDataset();
                        Severity: Minor
                        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                          Function useULS has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function useULS( trigger ) {
                                  const showButton = document.createElement( 'span' );
                          
                                  showButton.classList.add( 'ext-translate-cc-language-selector__trigger' );
                          
                          
                          Severity: Minor
                          Found in resources/src/ext.translate.cleanchanges/index.js - About 1 hr to fix

                            Function initCanvas has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function initCanvas(canvas, config) {
                                var style = canvas.style;
                            
                                // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
                                // returns null or '' if no explicit value has been set to the canvas attribute.
                            Severity: Minor
                            Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                              Function getSourceUnits has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function getSourceUnits( page ) {
                                      var api = new mw.Api();
                              
                                      return api.get( {
                                          action: 'query',
                              Severity: Minor
                              Found in resources/js/ext.translate.special.pagemigration.js - About 1 hr to fix

                                Function loadMessages has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function loadMessages() {
                                    var $messageTable = $( '.tux-messagelist' ),
                                        messagegroup = '!sandbox';
                                
                                    $( '<div>' )
                                Severity: Minor
                                Found in resources/src/ext.translate.specialTranslationStash/index.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language