wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
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 and 1 other location - About 3 hrs to fix
resources/lib/Chart.js/Chart.js on lines 3051..3058

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

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 (helpers_core.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 and 1 other location - About 3 hrs to fix
resources/lib/Chart.js/Chart.js on lines 4588..4595

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

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

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

( function () {
    'use strict';

    var resultGroups;

Severity: Minor
Found in resources/js/ext.translate.special.searchtranslations.js - About 3 hrs to fix

    Function drawPoint has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        drawPoint: function(ctx, style, radius, x, y, rotation) {
            var type, xOffset, yOffset, size, cornerRadius;
            var rad = (rotation || 0) * RAD_PER_DEG;
    
            if (style && typeof style === 'object') {
    Severity: Major
    Found in resources/lib/Chart.js/Chart.js - About 3 hrs to fix

      Method handleFuzzy has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function handleFuzzy( Title $title, bool $invalidate, PageUpdater $updater, int $baseTranver ): void {
              global $wgTranslateDocumentationLanguageCode;
              $editResult = $updater->getEditResult();
              if ( !$invalidate && !$editResult->isExactRevert() ) {
                  return;
      Severity: Major
      Found in src/Synchronization/UpdateMessageJob.php - About 3 hrs to fix

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

            public function execute() {
                $dryRun = $this->hasOption( 'dry-run' );
                $ttmServerId = $this->getOption( 'ttmserver' );
                $shouldReindex = $this->getOption( 'reindex', false );
        
        
        Severity: Minor
        Found in scripts/ttmserver-export.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 showPage has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            private function showPage( TranslatablePageMarkOperation $operation ): void {
                $page = $operation->getPage();
                $out = $this->getOutput();
                $out->addWikiMsg( 'tpt-showpage-intro' );
        
        
        Severity: Minor
        Found in src/PageTranslation/PageTranslationSpecialPage.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 formatChange has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function formatChange(
                MessageGroup $group,
                MessageSourceChange $changes,
                string $language,
                string $type,
        Severity: Minor
        Found in src/Synchronization/ManageGroupsSpecialPage.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 successFunction has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    var successFunction = function ( data ) {
                        var aggregateGroupId = data.aggregategroups.aggregategroupId;
                        var subGroupId = 'tp-subgroup-' + aggregateGroupId;
        
                        var $removeSpan = $( '<span>' ).attr( 'id', aggregateGroupId )
        Severity: Major
        Found in resources/js/ext.translate.special.aggregategroups.js - About 3 hrs to fix

          File TranslatableBundleMover.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

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

            $specialPageAliases['zh-hans'] = [
                'AggregateGroups' => [ '信息组总计' ],
                'ImportTranslations' => [ '导入翻译' ],
                'LanguageStats' => [ '语言统计' ],
                'ManageMessageGroups' => [ '信息组管理' ],
            Severity: Major
            Found in Translate.alias.php and 4 other locations - About 3 hrs to fix
            Translate.alias.php on lines 275..292
            Translate.alias.php on lines 442..459
            Translate.alias.php on lines 669..686
            Translate.alias.php on lines 1137..1154

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

            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 5 locations. Consider refactoring.
            Open

            $specialPageAliases['de'] = [
                'AggregateGroups' => [ 'Zusammenfassende_Nachrichtengruppen' ],
                'ImportTranslations' => [ 'Übersetzungen_importieren' ],
                'LanguageStats' => [ 'Sprachstatistiken' ],
                'ManageMessageGroups' => [ 'Nachrichtengruppen_verwalten' ],
            Severity: Major
            Found in Translate.alias.php and 4 other locations - About 3 hrs to fix
            Translate.alias.php on lines 442..459
            Translate.alias.php on lines 669..686
            Translate.alias.php on lines 1117..1134
            Translate.alias.php on lines 1137..1154

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

            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 5 locations. Consider refactoring.
            Open

            $specialPageAliases['he'] = [
                'AggregateGroups' => [ 'קבוצות_משולבות' ],
                'ImportTranslations' => [ 'ייבוא_תרגומים' ],
                'LanguageStats' => [ 'סטטיסטיקות_שפה' ],
                'ManageMessageGroups' => [ 'ניהול_קבוצות_הודעות' ],
            Severity: Major
            Found in Translate.alias.php and 4 other locations - About 3 hrs to fix
            Translate.alias.php on lines 275..292
            Translate.alias.php on lines 669..686
            Translate.alias.php on lines 1117..1134
            Translate.alias.php on lines 1137..1154

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

            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 5 locations. Consider refactoring.
            Open

            $specialPageAliases['mk'] = [
                'AggregateGroups' => [ 'ЗбирниГрупи' ],
                'ImportTranslations' => [ 'УвезиПреводи' ],
                'LanguageStats' => [ 'СтатистикиЗаЈазик' ],
                'ManageMessageGroups' => [ 'РаководењеСоГрупиНаПораки' ],
            Severity: Major
            Found in Translate.alias.php and 4 other locations - About 3 hrs to fix
            Translate.alias.php on lines 275..292
            Translate.alias.php on lines 442..459
            Translate.alias.php on lines 1117..1134
            Translate.alias.php on lines 1137..1154

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

            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 5 locations. Consider refactoring.
            Open

            $specialPageAliases['zh-hant'] = [
                'AggregateGroups' => [ '集合群組' ],
                'ImportTranslations' => [ '匯入翻譯' ],
                'LanguageStats' => [ '語言統計' ],
                'ManageMessageGroups' => [ '管理訊息群組' ],
            Severity: Major
            Found in Translate.alias.php and 4 other locations - About 3 hrs to fix
            Translate.alias.php on lines 275..292
            Translate.alias.php on lines 442..459
            Translate.alias.php on lines 669..686
            Translate.alias.php on lines 1117..1134

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

            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 execute has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function execute() {
                    $config = $this->getConfig();
                    $logger = LoggerFactory::getInstance( 'Translate.GroupSynchronization' );
                    $groupPattern = $this->getOption( 'group' ) ?? '';
                    $logger->info(
            Severity: Major
            Found in src/Synchronization/BackportTranslationsMaintenanceScript.php - About 3 hrs to fix

              MessageGroups has 30 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class MessageGroups {
                  /** @var MessageGroup[]|null Map of (group ID => MessageGroup) */
                  private $groups;
                  /** @var MessageGroupLoader[]|null */
                  private $groupLoaders;
              Severity: Minor
              Found in src/MessageGroupProcessing/MessageGroups.php - About 3 hrs to fix

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

                        if (tickOpts.max !== undefined) {
                            me.max = tickOpts.max;
                        } else if (tickOpts.suggestedMax !== undefined) {
                            if (me.max === null) {
                                me.max = tickOpts.suggestedMax;
                Severity: Major
                Found in resources/lib/Chart.js/Chart.js and 1 other location - About 3 hrs to fix
                resources/lib/Chart.js/Chart.js on lines 12765..12773

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

                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 (tickOpts.min !== undefined) {
                            me.min = tickOpts.min;
                        } else if (tickOpts.suggestedMin !== undefined) {
                            if (me.min === null) {
                                me.min = tickOpts.suggestedMin;
                Severity: Major
                Found in resources/lib/Chart.js/Chart.js and 1 other location - About 3 hrs to fix
                resources/lib/Chart.js/Chart.js on lines 12775..12783

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

                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 showTranslations has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function showTranslations( Title $title ): void {
                        $handle = new MessageHandle( $title );
                        $namespace = $title->getNamespace();
                        $message = $handle->getKey();
                
                
                Severity: Major
                Found in src/TranslatorInterface/TranslationsSpecialPage.php - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language