wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

File Chart.js has 11466 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Chart.js v2.9.3
 * https://www.chartjs.org
 * (c) 2019 Chart.js Contributors
 * Released under the MIT License
Severity: Major
Found in resources/lib/Chart.js/Chart.js - About 1 mo to fix

    Function conversions has 682 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var conversions = createCommonjsModule(function (module) {
    /* MIT license */
    
    
    // NOTE: conversions should only return primitive values (i.e. arrays, or
    Severity: Major
    Found in resources/lib/Chart.js/Chart.js - About 3 days to fix

      File Hooks.php has 1201 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace MediaWiki\Extension\Translate\PageTranslation;
      
      use Article;
      Severity: Major
      Found in src/PageTranslation/Hooks.php - About 3 days to fix

        Function execute has a Cognitive Complexity of 150 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute() {
                $output = $this->getOption( 'output', 'default' );
        
                // Select an output engine
                switch ( $output ) {
        Severity: Minor
        Found in scripts/groupStatistics.php - About 3 days 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

        File PageTranslationSpecialPage.php has 1046 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          File ext.translate.editor.js has 1033 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* global autosize */
          
          ( function () {
              'use strict';
          
          
          Severity: Major
          Found in resources/js/ext.translate.editor.js - About 2 days to fix

            Function core_helpers has 468 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var core_helpers = function() {
            
                // -- Basic js utility methods
            
                helpers$1.where = function(collection, filterCallback) {
            Severity: Major
            Found in resources/lib/Chart.js/Chart.js - About 2 days to fix

              File Translate.alias.php has 935 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Aliases for special pages of Translate extension.
               *
               * @file
              Severity: Major
              Found in Translate.alias.php - About 2 days to fix

                File ManageGroupsSpecialPage.php has 906 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                declare( strict_types = 1 );
                
                namespace MediaWiki\Extension\Translate\Synchronization;
                
                
                Severity: Major
                Found in src/Synchronization/ManageGroupsSpecialPage.php - About 2 days to fix

                  File HookHandler.php has 726 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  declare( strict_types=1 );
                  
                  namespace MediaWiki\Extension\Translate;
                  
                  
                  Severity: Major
                  Found in src/HookHandler.php - About 1 day to fix

                    Function prepareEditorColumn has 332 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            prepareEditorColumn: function () {
                                var translateEditor = this,
                                    $discardChangesButton = $( [] ),
                                    $saveButton = $( [] ),
                                    $messageTools = translateEditor.createMessageTools(),
                    Severity: Major
                    Found in resources/js/ext.translate.editor.js - About 1 day to fix

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

                          public function execute() {
                              $output = $this->getOption( 'output', 'default' );
                      
                              // Select an output engine
                              switch ( $output ) {
                      Severity: Major
                      Found in scripts/groupStatistics.php - About 1 day to fix

                        File ext.translate.messagetable.js has 621 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        ( function () {
                            'use strict';
                        
                            var itemsClass = {
                                proofread: '.tux-message-proofread',
                        Severity: Major
                        Found in resources/js/ext.translate.messagetable.js - About 1 day to fix

                          Function execute has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function execute( array $messages ): bool {
                                  $context = RequestContext::getMain();
                                  $output = $context->getOutput();
                          
                                  // Set up diff engine
                          Severity: Minor
                          Found in src/Synchronization/MessageWebImporter.php - About 1 day 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 setupTranslate has 258 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function setupTranslate(): void {
                                  global $wgTranslateYamlLibrary, $wgLogTypes;
                                  $hooks = [];
                          
                                  /*
                          Severity: Major
                          Found in src/HookHandler.php - About 1 day to fix

                            Function execute has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function execute(): void {
                                    $this->checkUserRightsAny( self::$right );
                                    $block = $this->getUser()->getBlock();
                                    if ( $block && $block->isSitewide() ) {
                                        $this->dieBlocked( $block );
                            Severity: Minor
                            Found in src/MessageGroupProcessing/AggregateGroupsActionApi.php - About 1 day 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

                            File ext.translate.special.managetranslatorsandbox.js has 558 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /*!
                             * JS for special page.
                             * @author Niklas Laxström
                             * @author Sucheta Ghoshal
                             * @author Amir E. Aharoni
                            Severity: Major
                            Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 day to fix

                              File MessageCollection.php has 546 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              declare( strict_types = 1 );
                              
                              namespace MediaWiki\Extension\Translate\MessageLoading;
                              
                              
                              Severity: Major
                              Found in src/MessageLoading/MessageCollection.php - About 1 day to fix

                                File ext.translate.editor.helpers.js has 528 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /*!
                                 * Translate editor additional helper functionality
                                 */
                                ( function () {
                                    'use strict';
                                Severity: Major
                                Found in resources/js/ext.translate.editor.helpers.js - About 1 day to fix

                                  Function execute has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function execute() {
                                          $logger = LoggerFactory::getInstance( 'Translate.GroupSynchronization' );
                                          $groupPattern = $this->getOption( 'group' ) ?? '';
                                          $groupSkipPattern = $this->getOption( 'skipgroup' ) ?? '';
                                          $skipGroupSyncCheck = $this->hasOption( 'skip-group-sync-check' );
                                  Severity: Minor
                                  Found in src/Synchronization/ExportTranslationsMaintenanceScript.php - About 1 day 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language