wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              $element
                                  .find( '.ext-translate-target-language' )
                                  .text( languageDetails.autonym )
                                  .prop( {
                                      lang: languageDetails.code,
              Severity: Minor
              Found in resources/js/ext.translate.special.translate.js and 1 other location - About 45 mins to fix
              resources/src/ext.translate.specialTranslationStash/index.js on lines 223..229

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          $ulsTrigger
                              .find( '.ext-translate-target-language' )
                              .text( languageDetails.autonym )
                              .prop( {
                                  lang: languageDetails.code,
              Severity: Minor
              Found in resources/src/ext.translate.specialTranslationStash/index.js and 1 other location - About 45 mins to fix
              resources/js/ext.translate.special.translate.js on lines 378..384

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  var next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi;
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 45 mins to fix
              resources/lib/Chart.js/Chart.js on lines 14093..14093

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  var prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo;
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 45 mins to fix
              resources/lib/Chart.js/Chart.js on lines 14094..14094

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  clearer: function (ratio) {
                      var alpha = this.values.alpha;
                      this.setValues('alpha', alpha - (alpha * ratio));
                      return this;
                  },
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 40 mins to fix
              resources/lib/Chart.js/Chart.js on lines 1907..1911

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language