wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $groupId,
        string $name,
        int $pageId,
        int $revisionId,
        ?string $description,
Severity: Minor
Found in src/MessageBundleTranslation/MessageBundleMessageGroup.php - About 45 mins to fix

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

        public function execute() {
            $this->checkUserRightsAny( self::RIGHT );
            $block = $this->getUser()->getBlock();
            if ( $block && $block->isSitewide() ) {
                $this->dieBlocked( $block );
    Severity: Minor
    Found in src/Synchronization/ManageGroupSynchronizationCacheActionApi.php - About 45 mins 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 syncStatus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function syncStatus( array $bundlesWithDifference, string $differenceType ): void {
            if ( !$bundlesWithDifference ) {
                $this->output( "No \"$differenceType\" bundle statuses\n" );
                return;
            }
    Severity: Minor
    Found in src/Diagnostics/SyncTranslatableBundleStatusMaintenanceScript.php - About 45 mins 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 import has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            string $importFilePath,
            string $interwikiPrefix,
            bool $assignKnownUsers,
            UserIdentity $user,
            ?Title $targetPage,
    Severity: Minor
    Found in src/MessageGroupProcessing/TranslatableBundleImporter.php - About 45 mins to fix

      Function breakRename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function breakRename( $languageCode, $msgKey ) {
              $msg = $this->findMessage( $languageCode, $msgKey, [ self::RENAME ] );
              if ( $msg === null ) {
                  return null;
              }
      Severity: Minor
      Found in src/MessageSync/MessageSourceChange.php - About 45 mins 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run() {
              $title = $this->title;
              $fuzzyBot = FuzzyBot::getUser();
              $summary = $this->getSummary();
              $base = $this->getBase();
      Severity: Minor
      Found in src/MessageGroupProcessing/DeleteTranslatableBundleJob.php - About 45 mins 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 newJob has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              Title $target,
              string $base,
              string $bundleType,
              bool $isTranslationPage,
              UserIdentity $performer,
      Severity: Minor
      Found in src/MessageGroupProcessing/DeleteTranslatableBundleJob.php - About 45 mins to fix

        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                LinkBatchFactory $linkBatchFactory,
                ProgressStatsTableFactory $progressStatsTableFactory,
                LanguageNameUtils $languageNameUtils,
                JobQueueGroup $jobQueueGroup,
                MessageGroupReviewStore $groupReviewStore,
        Severity: Minor
        Found in src/Statistics/LanguageStatsSpecialPage.php - About 45 mins to fix

          Function execute has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 indexOf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function indexOf( stdClass $row ): ?array {
                  if ( $this->opts->getValue( 'count' ) === 'users' ) {
                      $date = $this->formatTimestamp( $row->rc_timestamp );
          
                      if ( isset( $this->seenUsers[$date][$row->rc_actor] ) ) {
          Severity: Minor
          Found in src/Statistics/TranslatePerLanguageStats.php - About 45 mins 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 identifyDifferences has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function identifyDifferences(
                  array $translatableBundles,
                  array $translatableBundleStatuses
              ): array {
                  $result = [
          Severity: Minor
          Found in src/Diagnostics/SyncTranslatableBundleStatusMaintenanceScript.php - About 45 mins 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 filterPriorityLangs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function filterPriorityLangs( array &$languages, string $group, array $cache ): void {
                  $filterLangs = $this->messageGroupMetadata->get( $group, 'prioritylangs' );
                  if ( $filterLangs === false || strlen( $filterLangs ) === 0 ) {
                      // No restrictions, keep everything
                      return;
          Severity: Minor
          Found in src/Statistics/MessageGroupStatsTable.php - About 45 mins 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 newJob has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  Title $source,
                  Title $target,
                  array $moves,
                  array $redirects,
                  string $reason,
          Severity: Minor
          Found in src/MessageGroupProcessing/MoveTranslatableBundleJob.php - About 45 mins to fix

            Function writeReal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function writeReal( MessageCollection $collection ): string {
                    $output = '';
                    $mangler = $this->group->getMangler();
            
                    /** @var Message $m */
            Severity: Minor
            Found in src/FileFormatSupport/IniFormat.php - About 45 mins 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 formatMessageBlock has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $key,
                    Message $message,
                    array $trans,
                    array $pot,
                    int $pluralCount,
            Severity: Minor
            Found in src/FileFormatSupport/GettextFormat.php - About 45 mins to fix

              Method runValidation has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      array $validatorData,
                      Message $message,
                      string $targetLanguage,
                      ValidationIssues $errors,
                      ValidationIssues $warnings,
              Severity: Minor
              Found in src/Validation/ValidationRunner.php - About 45 mins to fix

                Function pluralPresenceCheck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function pluralPresenceCheck(
                        $definitionHasPlural,
                        $translationHasPlural,
                        $expectedPluralCount
                    ) {
                Severity: Minor
                Found in src/Validation/Validators/GettextPluralValidator.php - About 45 mins 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 writeReal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function writeReal( MessageCollection $collection ): string {
                        $output = $this->doHeader( $collection );
                        $output .= $this->doAuthors( $collection );
                
                        $mangler = $this->group->getMangler();
                Severity: Minor
                Found in src/FileFormatSupport/YamlFormat.php - About 45 mins 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

                Consider simplifying this complex logical expression.
                Open

                                if (
                                    e.type === 'keydown' &&
                                    e.altKey === true &&
                                    e.ctrlKey === false &&
                                    e.shiftKey === false &&
                Severity: Major
                Found in resources/js/ext.translate.editor.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                      if (helpers$1.isObject(value)) {
                          t = +value.top || 0;
                          r = +value.right || 0;
                          b = +value.bottom || 0;
                          l = +value.left || 0;
                  Severity: Major
                  Found in resources/lib/Chart.js/Chart.js - About 40 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language