wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

MessageWebImporter has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class MessageWebImporter {
    private Title $title;
    private User $user;
    private MessageGroup $group;
    private string $code;
Severity: Minor
Found in src/Synchronization/MessageWebImporter.php - About 2 hrs to fix

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

        draw: function() {
            var me = this;
            var vm = me._view;
            var ctx = me._chart.ctx;
            var spanGaps = vm.spanGaps;
    Severity: Major
    Found in resources/lib/Chart.js/Chart.js - About 2 hrs to fix

      Function showEditSummaries has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              showEditSummaries: function ( editsummaries ) {
                  if ( !editsummaries.length ) {
                      return;
                  }
      
      
      Severity: Major
      Found in resources/js/ext.translate.editor.helpers.js - About 2 hrs to fix

        Method parse has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function parse() {
                $data = file_get_contents( $this->file );
                $data = TextContent::normalizeLineEndings( $data );
        
                $matches = [];
        Severity: Major
        Found in scripts/poimport.php - About 2 hrs to fix

          Method tabify has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function tabify( Skin $skin, array &$tabs ): bool {
                  $title = $skin->getTitle();
                  if ( !$title->isSpecialPage() ) {
                      return true;
                  }
          Severity: Major
          Found in src/TranslatorInterface/TranslateSpecialPage.php - About 2 hrs to fix

            Method handleRename has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function handleRename(
                    MessageGroup $group,
                    MessageSourceChange $sourceChanges,
                    string $msgKey,
                    string $keyToRename,
            Severity: Major
            Found in src/MessageGroupProcessing/ManageMessageGroupsActionApi.php - About 2 hrs to fix

              File Utilities.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              declare( strict_types = 1 );
              
              namespace MediaWiki\Extension\Translate\Utilities;
              
              
              Severity: Minor
              Found in src/Utilities/Utilities.php - About 2 hrs to fix

                Function updateGroupPriorityWarnings has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function updateGroupPriorityWarnings( group, language ) {
                        var $groupWarning = $( '.tux-editor-header .tux-group-warning' );
                
                        if ( group.priority === 'discouraged' ) {
                            $groupWarning.append(
                Severity: Major
                Found in resources/js/ext.translate.special.translate.js - About 2 hrs to fix

                  Function determineAlignment has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function determineAlignment(tooltip, size) {
                      var model = tooltip._model;
                      var chart = tooltip._chart;
                      var chartArea = tooltip._chart.chartArea;
                      var xAlign = 'center';
                  Severity: Major
                  Found in resources/lib/Chart.js/Chart.js - About 2 hrs to fix

                    Function _drawGrid has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _drawGrid: function(chartArea) {
                            var me = this;
                            var gridLines = me.options.gridLines;
                    
                            if (!gridLines.display) {
                    Severity: Major
                    Found in resources/lib/Chart.js/Chart.js - About 2 hrs to fix

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

                          public function execute() {
                              global $wgTranslateMessageNamespaces;
                      
                              $namespace = $this->getOption( 'namespace', $wgTranslateMessageNamespaces );
                              $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
                      Severity: Major
                      Found in scripts/populateFuzzy.php - About 2 hrs to fix

                        Function determineDataLimits has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            determineDataLimits: function() {
                                var me = this;
                                var chart = me.chart;
                                var adapter = me._adapter;
                                var options = me.options;
                        Severity: Major
                        Found in resources/lib/Chart.js/Chart.js - About 2 hrs to fix

                          File ManageMessageGroupSubscriptionsSpecialPage.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          declare( strict_types = 1 );
                          
                          namespace MediaWiki\Extension\Translate\PageTranslation;
                          
                          
                          Severity: Minor
                          Found in src/PageTranslation/ManageMessageGroupSubscriptionsSpecialPage.php - About 2 hrs to fix

                            File QueryMessageCollectionActionApi.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            declare( strict_types = 1 );
                            
                            namespace MediaWiki\Extension\Translate\MessageLoading;
                            
                            
                            Severity: Minor
                            Found in src/MessageLoading/QueryMessageCollectionActionApi.php - About 2 hrs to fix

                              Function getLookupMenuOptionsFromData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                              EntitySelectorWidget.prototype.getLookupMenuOptionsFromData = function ( response ) {
                                  var groups = response.groups || [];
                                  var messages = response.messages || [];
                                  var finalResult = [];
                                  var i = 0;
                              Severity: Minor
                              Found in resources/src/ext.translate.entity.selector/index.js - About 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function populateQueries has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function validate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function validate( Title $pageTitle, MessageBundleContent $content ): void {
                                      $content->validate();
                                      // Verify that the language code is valid
                                      $metadata = $content->getMetadata();
                                      $sourceLanguageCode = $metadata->getSourceLanguageCode();
                              Severity: Minor
                              Found in src/MessageBundleTranslation/MessageBundleStore.php - About 2 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

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

                                  public function execute() {
                                      $codes = MediaWikiServices::getInstance()
                                          ->getLanguageNameUtils()
                                          ->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::ALL );
                              
                              
                              Severity: Major
                              Found in scripts/createCheckIndex.php - About 2 hrs to fix

                                Function _computeLabelItems has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    _computeLabelItems: function() {
                                        var me = this;
                                        var options = me.options;
                                        var optionTicks = options.ticks;
                                        var position = options.position;
                                Severity: Major
                                Found in resources/lib/Chart.js/Chart.js - About 2 hrs to fix

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

                                      update: function(maxWidth, maxHeight, margins) {
                                          var me = this;
                                          var tickOpts = me.options.ticks;
                                          var sampleSize = tickOpts.sampleSize;
                                          var i, ilen, labels, ticks, samplingEnabled;
                                  Severity: Major
                                  Found in resources/lib/Chart.js/Chart.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language