wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

    public function __construct() {
        parent::__construct();
        $this->addDescription( 'Import translations for a CSV file' );

        $this->addArg(
Severity: Minor
Found in src/MessageGroupProcessing/ImportTranslationsFromCsv.php - About 1 hr to fix

    Method fixMessageParams has 26 lines of code (exceeds 25 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

      Method pluralFormsCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function pluralFormsCheck(
              Message $message, string $code, ValidationIssues $issues
          ): void {
              $translation = $message->translation();
              // Are there any plural forms for this language in this message?
      Severity: Minor
      Found in src/Validation/Validators/MediaWikiPluralValidator.php - About 1 hr to fix

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

            public function __construct() {
                parent::__construct();
                $this->addDescription( 'Script to show number of characters translated .' );
                $this->addOption(
                    'top',
        Severity: Major
        Found in scripts/characterEditStats.php and 1 other location - About 1 hr to fix
        scripts/poimport.php on lines 30..52

        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 101.

        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

            public function __construct() {
                parent::__construct();
                $this->addDescription( 'Po file importer (does not make changes unless specified).' );
                $this->addOption(
                    'file',
        Severity: Major
        Found in scripts/poimport.php and 1 other location - About 1 hr to fix
        scripts/characterEditStats.php on lines 27..49

        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 101.

        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

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

                MessageIndexStore $store,
                WANObjectCache $statusCache,
                JobQueueGroup $jobQueueGroup,
                HookRunner $hookRunner,
                LoggerInterface $logger,
        Severity: Major
        Found in src/MessageLoading/MessageIndex.php - About 1 hr to fix

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

                  MovePageFactory $movePageFactory,
                  JobQueueGroup $jobQueue,
                  LinkBatchFactory $linkBatchFactory,
                  TranslatableBundleFactory $bundleFactory,
                  SubpageListBuilder $subpageBuilder,
          Severity: Major
          Found in src/PageTranslation/TranslatableBundleMover.php - About 1 hr to fix

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

                    Language $contLang,
                    NamespaceInfo $nsInfo,
                    RevisionLookup $revLookup,
                    GroupSynchronizationCache $synchronizationCache,
                    JobQueueGroup $jobQueueGroup,
            Severity: Major
            Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

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

                          if ( messagegroup.icon && messagegroup.icon.raster ) {
                              style += 'background-image: url(--);';
                              style = style.replace( /--/g, messagegroup.icon.raster );
                          }
              Severity: Minor
              Found in resources/src/ext.translate.groupselector/index.js and 1 other location - About 55 mins to fix
              resources/src/ext.translate.groupselector/index.js on lines 579..582

              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 54.

              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

                      return {
                          x: vm.x + Math.cos(halfAngle) * halfRadius,
                          y: vm.y + Math.sin(halfAngle) * halfRadius
                      };
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 55 mins to fix
              resources/lib/Chart.js/Chart.js on lines 4264..4267

              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 54.

              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 $addAsRename = $( '<li>' ).append(
                                  $( '<button>' )
                                      .attr( 'type', 'button' )
                                      .addClass( 'smg-rename-new-action mw-translate-hide' )
                                      .text( mw.msg( 'translate-smg-rename-new' ) )
              Severity: Minor
              Found in resources/js/ext.translate.special.managegroups.js and 1 other location - About 55 mins to fix
              resources/js/ext.translate.special.managegroups.js on lines 266..271

              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 54.

              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

                          return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 55 mins to fix
              resources/lib/Chart.js/Chart.js on lines 2605..2605

              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 54.

              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

                      return {
                          x: vm.x + (Math.cos(centreAngle) * rangeFromCentre),
                          y: vm.y + (Math.sin(centreAngle) * rangeFromCentre)
                      };
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 55 mins to fix
              resources/lib/Chart.js/Chart.js on lines 4248..4251

              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 54.

              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

                              $addAsNew = $( '<li>' ).append(
                                  $( '<button>' )
                                      .attr( 'type', 'button' )
                                      .addClass( 'smg-rename-rename-action mw-translate-hide' )
                                      .text( mw.msg( 'translate-smg-rename-rename' ) )
              Severity: Minor
              Found in resources/js/ext.translate.special.managegroups.js and 1 other location - About 55 mins to fix
              resources/js/ext.translate.special.managegroups.js on lines 260..265

              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 54.

              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

                      return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js and 1 other location - About 55 mins to fix
              resources/lib/Chart.js/Chart.js on lines 2650..2650

              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 54.

              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

                          if ( messagegroup.icon && messagegroup.icon.vector ) {
                              style += 'background-image: url(--);';
                              style = style.replace( /--/g, messagegroup.icon.vector );
                          }
              Severity: Minor
              Found in resources/src/ext.translate.groupselector/index.js and 1 other location - About 55 mins to fix
              resources/src/ext.translate.groupselector/index.js on lines 574..577

              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 54.

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

                  public static function determineStatus(
                      ?int $readyRevisionId,
                      ?int $markRevisionId,
                      int $latestRevisionId
                  ): ?TranslatablePageStatus {
              Severity: Minor
              Found in src/PageTranslation/TranslatablePage.php - About 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function execute() {
                      $target = rtrim( $this->getOption( 'target' ), '/' );
                      $sourceLanguage = $this->getOption( 'source-language' );
                      $targetLanguage = $this->getOption( 'target-language' );
              
              
              Severity: Minor
              Found in scripts/export-rename-language.php - About 55 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 getNormalForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getNormalForm(): HTMLForm {
                      $fields = [];
              
                      // Allow subscribers to manipulate the list of watched pages (or use it
                      // to preload lots of details at once)
              Severity: Minor
              Found in src/PageTranslation/ManageMessageGroupSubscriptionsSpecialPage.php - About 55 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 filterOnCondition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function filterOnCondition( array $keys, array $condKeys, bool $condition = true ): array {
                      if ( $condition ) {
                          // Delete $condKeys from $keys
                          foreach ( array_keys( $condKeys ) as $key ) {
                              unset( $keys[$key] );
              Severity: Minor
              Found in src/MessageLoading/MessageCollection.php - About 55 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

              Severity
              Category
              Status
              Source
              Language