wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Method showAggregateGroup has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function showAggregateGroup( AggregateMessageGroup $group ): string {
        $id = $group->getId();
        $label = $group->getLabel();
        $desc = $group->getDescription( $this->getContext() );
        $sourceLanguage = $this->messageGroupMetadata->get( $id, 'sourcelanguagecode' );
Severity: Major
Found in src/MessageGroupProcessing/AggregateGroupsSpecialPage.php - About 3 hrs to fix

    File MessageIndex.php has 301 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/MessageIndex.php - About 3 hrs to fix

      Function load has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              load: function ( limit ) {
                  var self = this,
                      offset = this.$loader.data( 'offset' ),
                      pageSize = limit || this.$loader.data( 'pagesize' );
      
      
      Severity: Major
      Found in resources/js/ext.translate.messagetable.js - About 3 hrs to fix

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

            public function execute() {
                $this->checkUserRightsAny( 'pagetranslation' );
        
                $params = $this->extractRequestParams();
                $title = $this->getTitleFromTitleOrPageId( $params );
        Severity: Major
        Found in src/PageTranslation/MarkForTranslationActionApi.php - About 3 hrs to fix

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

              public function __construct() {
                  parent::__construct();
                  $this->addDescription( 'Export translations to files.' );
          
                  $this->addOption(
          Severity: Major
          Found in src/Synchronization/ExportTranslationsMaintenanceScript.php - About 3 hrs to fix

            File ExternalMessageSourceStateComparator.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              HookHandler has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class HookHandler implements
                  ChangeTagsListActiveHook,
                  ListDefinedTagsHook,
                  ParserFirstCallInitHook,
                  RevisionRecordInsertedHook,
              Severity: Minor
              Found in src/HookHandler.php - About 3 hrs to fix

                MessageGroupStats has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class MessageGroupStats {
                    /** Name of the database table */
                    private const TABLE = 'translate_groupstats';
                    /** Cache key for storage of all language stats */
                    private const LANGUAGE_STATS_KEY = 'translate-all-language-stats';
                Severity: Minor
                Found in src/Statistics/MessageGroupStats.php - About 3 hrs to fix

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

                      public function execute() {
                          $dbr = $this->getDB( DB_REPLICA );
                  
                          $users = $dbr->newSelectQueryBuilder()
                              ->select( [
                  Severity: Major
                  Found in scripts/translator-stats.php - About 3 hrs to fix

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

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

                      Method addMessageUpdateChanges has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function addMessageUpdateChanges(
                              FileBasedMessageGroup $group,
                              string $language,
                              MessageSourceChange $changes,
                              int $reason,
                      Severity: Major
                      Found in src/Synchronization/ExternalMessageSourceStateComparator.php - About 3 hrs to fix

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

                            public function execute() {
                                $dbr = $this->getDB( DB_REPLICA );
                        
                                $users = $dbr->newSelectQueryBuilder()
                                    ->select( [
                        Severity: Minor
                        Found in scripts/translator-stats.php - About 3 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 replaceSubtitle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function replaceSubtitle( &$subpages, ?Skin $skin, OutputPage $out ) {
                                $linker = MediaWikiServices::getInstance()->getLinkRenderer();
                        
                                $isTranslationPage = TranslatablePage::isTranslationPage( $out->getTitle() );
                                if ( !$isTranslationPage
                        Severity: Minor
                        Found in src/PageTranslation/Hooks.php - About 3 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 processSubmit has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function processSubmit(): void {
                                $req = $this->getRequest();
                                $out = $this->getOutput();
                                $errorGroups = [];
                        
                        
                        Severity: Minor
                        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 3 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 setupTranslate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function setupTranslate(): void {
                                global $wgTranslateYamlLibrary, $wgLogTypes;
                                $hooks = [];
                        
                                /*
                        Severity: Minor
                        Found in src/HookHandler.php - About 3 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 getParentGroups has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getParentGroups( MessageGroup $targetGroup ): array {
                                $ids = self::getSharedGroups( $targetGroup );
                                if ( $ids === [] ) {
                                    return [];
                                }
                        Severity: Minor
                        Found in src/MessageGroupProcessing/MessageGroups.php - About 3 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 getTranslatableLanguages has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getTranslatableLanguages() {
                                $groupConfiguration = $this->getConfiguration();
                                if ( !isset( $groupConfiguration['LANGUAGES'] ) ) {
                                    // No LANGUAGES section in the configuration.
                                    return null;
                        Severity: Minor
                        Found in messagegroups/MessageGroupBase.php - About 3 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 showTranslationSettings has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function showTranslationSettings( Title $target, ?ErrorPageError $block ): void {
                                $out = $this->getOutput();
                                $out->setPageTitle( $this->msg( 'tpt-translation-settings-page-title' )->text() );
                        
                                $currentState = $this->translatablePageStateStore->get( $target );
                        Severity: Major
                        Found in src/PageTranslation/PageTranslationSpecialPage.php - About 3 hrs to fix

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

                              update: function(changed) {
                                  var me = this;
                                  var opts = me._options;
                          
                                  // Need to regenerate the model because its faster than using extend and it is necessary due to the optimization in Chart.Element.transition
                          Severity: Major
                          Found in resources/lib/Chart.js/Chart.js - About 3 hrs to fix

                            Function render has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    render: function () {
                                        // List of all reviewers
                                        var reviewers = this.message.properties.reviewers || [];
                                        // The id of the current user, converted to string as the are in reviewers
                                        var userId = String( mw.config.get( 'wgUserId' ) );
                            Severity: Major
                            Found in resources/js/ext.translate.proofread.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language