wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Method import has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function import(
        string $importFilePath,
        string $interwikiPrefix,
        bool $assignKnownUsers,
        UserIdentity $user,
Severity: Minor
Found in src/MessageGroupProcessing/TranslatableBundleImporter.php - About 1 hr to fix

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

        public function execute() {
            $user = $this->getUser();
            $requestParams = $this->extractRequestParams();
    
            $group = MessageGroups::getGroup( $requestParams['group'] );
    Severity: Minor
    Found in src/MessageGroupProcessing/GroupReviewActionApi.php - About 1 hr to fix

      Function languages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function languages( $data, $params, $parser ) {
              global $wgPageTranslationLanguageList;
      
              if ( $wgPageTranslationLanguageList === 'sidebar-only' ) {
                  return '';
      Severity: Minor
      Found in src/PageTranslation/Hooks.php - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute(): void {
              $params = $this->extractRequestParams();
      
              $title = Title::newFromText( $params['title'] );
              if ( !$title ) {
      Severity: Minor
      Found in src/MessageLoading/QueryMessageTranslationsActionApi.php - About 1 hr 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 getLanguageExportActions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getLanguageExportActions(
              string $groupId,
              array $requestedLanguages,
              array $alwaysExportLanguages,
              int $exportThreshold = 0,
      Severity: Minor
      Found in src/Synchronization/ExportTranslationsMaintenanceScript.php - About 1 hr 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 processGroups has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function processGroups( array $groups ): array {
              $fixedGroups = [];
              foreach ( $groups as $g ) {
                  $name = $g['name'];
                  $sanitizedName = preg_replace( '/\s+/', '', strtolower( $name ) );
      Severity: Minor
      Found in src/MessageGroupConfiguration/PremadeIntuitionTextdomains.php - About 1 hr 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 getTranslationsWithFallback has a Cognitive Complexity of 12 (exceeds 5 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

      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 normalize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function normalize( array $validCounts ): void {
              $this->formOptions->validateIntBounds( 'days', 1, 10000 );
              $this->formOptions->validateIntBounds( 'width', 200, 1000 );
              $this->formOptions->validateIntBounds( 'height', 200, 1000 );
      
      
      Severity: Minor
      Found in src/Statistics/TranslationStatsGraphOptions.php - About 1 hr 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 doExport has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function doExport(): Status {
              $out = $this->getOutput();
              $group = MessageGroups::getGroup( $this->groupId );
              $collection = $this->setupCollection( $group );
      
      
      Severity: Minor
      Found in src/Synchronization/ExportTranslationsSpecialPage.php - About 1 hr 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 getMessages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getMessages(): array {
              if ( $this->messages !== null ) {
                  return $this->messages;
              }
      
      
      Severity: Minor
      Found in src/MessageBundleTranslation/MessageBundleContent.php - About 1 hr 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 isTranslatableMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function isTranslatableMessage( MessageHandle $handle, string $targetLanguage ): bool {
              static $cache = [];
      
              if ( !$handle->isValid() ) {
                  return false;
      Severity: Minor
      Found in src/MessageGroupProcessing/MessageGroups.php - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute() {
              $csvFilePath = $this->getArg( 0 );
      
              $username = $this->getOption( 'user' );
              $summary = $this->getOption( 'summary' );
      Severity: Minor
      Found in src/MessageGroupProcessing/ImportTranslationsFromCsv.php - About 1 hr 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 readFromVariable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function readFromVariable( string $data ): array {
              $reader = new SimpleXMLElement( $data );
      
              $messages = [];
              $mangler = $this->group->getMangler();
      Severity: Minor
      Found in src/FileFormatSupport/AndroidXmlFormat.php - About 1 hr 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 fixMessageParams has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function fixMessageParams( IContextSource $context, array $params ): array {
              $out = [];
              $lang = $context->getLanguage();
      
              foreach ( $params as $param ) {
      Severity: Minor
      Found in src/Validation/ValidationResult.php - About 1 hr 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 init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          LanguageFilter.prototype.init = function () {
              var languageFilter = this;
      
              var $clearButton = $( '<button>' )
                  .addClass( 'clear-language-selector hide' )
      Severity: Minor
      Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

        Function alignHeaders has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function alignHeaders( units, translationUnits ) {
                // The content does not have information about the page title. Add an empty string
                // at the beginning of the translationUnits array to match the length of units and
                // translationUnits.
                if ( units.length && units[ 0 ].identifier === 'Page_display_title' ) {
        Severity: Minor
        Found in resources/js/ext.translate.special.pagemigration.js - About 1 hr to fix

          Function getMaxBorderWidth has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getMaxBorderWidth: function(arcs) {
                  var me = this;
                  var max = 0;
                  var chart = me.chart;
                  var i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;
          Severity: Minor
          Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

            Method getPageList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getPageList( array $pages, string $type ): string {
                    $items = [];
                    $tagsTextCache = [];
            
                    $tagDiscouraged = $this->msg( 'tpt-tag-discouraged' )->escaped();
            Severity: Minor
            Found in src/PageTranslation/PageTranslationSpecialPage.php - About 1 hr to fix

              Method deleteAsynchronously has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function deleteAsynchronously(
                      Title $title,
                      bool $isTranslation,
                      UserIdentity $user,
                      array $subpageList,
              Severity: Minor
              Found in src/PageTranslation/TranslatableBundleDeleter.php - About 1 hr to fix

                Method requeueError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function requeueError( string $serviceName, Exception $e ): void {
                        $this->logger->warning(
                            'Exception thrown while running {command} on ' .
                            'service {service}: {errorMessage}',
                            [
                Severity: Minor
                Found in src/TtmServer/TtmServerMessageUpdateJob.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language