wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function import has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function import( array $changeData, string $name, int $importStrategy ): array {
        $processed = [];
        $skipped = [];
        $jobs = [];

Severity: Minor
Found in src/Synchronization/ExternalMessageSourceStateImporter.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 processSubmit has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function processSubmit(): void {
        $req = $this->getRequest();
        $out = $this->getOutput();
        $errorGroups = [];

Severity: Major
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 3 hrs to fix

    Function _computeGridLineItems has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

      ( function () {
          var RenameDropdown,
              GroupSynchronization;
      
          $( function () {
      Severity: Minor
      Found in resources/js/ext.translate.special.managegroups.js - About 3 hrs to fix

        File ttmserver-export.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Script to bootstrap TtmServer translation memory
         *
         * @author Niklas Laxström
        Severity: Minor
        Found in scripts/ttmserver-export.php - About 3 hrs to fix

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

            Method showChanges has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function showChanges( int $limit ): void {
                    $diff = new DifferenceEngine( $this->getContext() );
                    $diff->showDiffStyle();
                    $diff->setReducedLineNumbers();
                    $this->diff = $diff;
            Severity: Major
            Found in src/Synchronization/ManageGroupsSpecialPage.php - About 3 hrs to fix

              Method doQuery has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function doQuery( string $sourceLanguage, string $targetLanguage, string $text ): array {
                      if ( !$this->useWikimediaExtraPlugin() ) {
                          // ElasticTTM is currently not compatible with elasticsearch 2.x/5.x
                          // It needs FuzzyLikeThis ported via the wmf extra plugin
                          throw new RuntimeException( 'The wikimedia extra plugin is mandatory.' );
              Severity: Major
              Found in src/TtmServer/ElasticSearchTtmServer.php - About 3 hrs to fix

                Method getGraphData has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getGraphData( TranslationStatsGraphOptions $opts, Language $language ): array {
                        $dbr = $this->dbProvider->getReplicaDatabase();
                
                        $so = $this->getStatsProvider( $opts->getValue( 'count' ), $opts );
                
                
                Severity: Major
                Found in src/Statistics/TranslationStatsDataProvider.php - About 3 hrs to fix

                  Function showTranslationMemory has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function sendNotifications has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function sendNotifications( array $changesToProcess ): void {
                            if ( !$this->isEnabled() || $changesToProcess === [] ) {
                                return;
                            }
                    
                    
                    Severity: Minor
                    Found in src/MessageGroupProcessing/MessageGroupSubscription.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

                    File ActiveLanguagesSpecialPage.php has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

                      MessageGroupOld has 28 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class MessageGroupOld implements MessageGroup {
                          /**
                           * Human-readable name of this group
                           * @var string
                           */
                      Severity: Minor
                      Found in messagegroups/MessageGroupOld.php - About 3 hrs to fix

                        Function displayEmptyListHelp has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                displayEmptyListHelp: function () {
                                    var messageTable = this,
                                        // @todo Ugly! This should be provided somehow
                                        selectedTab = $( '.tux-message-selector .selected' ).data( 'title' ),
                                        $wrap = $( '<div>' ).addClass( 'tux-empty-list' ),
                        Severity: Major
                        Found in resources/js/ext.translate.messagetable.js - About 3 hrs to fix

                          Function displayPagesToMove has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function displayPagesToMove( PageMoveCollection $pageCollection, bool $leaveRedirect ): void {
                                  $infoMessage = "\nThe following pages will be moved:\n";
                                  $count = 0;
                                  $subpagesCount = 0;
                                  $talkpagesCount = 0;
                          Severity: Minor
                          Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.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 execute has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function execute() {
                                  $codes = MediaWikiServices::getInstance()
                                      ->getLanguageNameUtils()
                                      ->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::ALL );
                          
                          
                          Severity: Minor
                          Found in scripts/createCheckIndex.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 createMessageGroup has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function createMessageGroup( string $id, array $info ): MessageGroup {
                                  $conf = [];
                                  $conf['BASIC']['class'] = MediaWikiExtensionMessageGroup::class;
                                  $conf['BASIC']['id'] = $id;
                                  $conf['BASIC']['namespace'] = $this->getNamespace();
                          Severity: Minor
                          Found in src/MessageGroupConfiguration/PremadeMediaWikiExtensionGroups.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 identifySafeLanguages has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function identifySafeLanguages(
                                  FileBasedMessageGroup $group,
                                  MessageSourceChange $changesForGroup,
                                  int $importStrategy
                              ): array {
                          Severity: Minor
                          Found in src/Synchronization/ExternalMessageSourceStateImporter.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 parseGettextSection has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function parseGettextSection( string $section, ?int $pluralCount ): ?array {
                                  if ( trim( $section ) === '' ) {
                                      return null;
                                  }
                          
                          
                          Severity: Minor
                          Found in src/FileFormatSupport/GettextFormat.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 showLanguages has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function showLanguages() {
                                  var ulslanguages = [],
                                      selectedClasss = '',
                                      quickLanguageList = [],
                                      unique = [];
                          Severity: Major
                          Found in resources/js/ext.translate.special.searchtranslations.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language