wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function pluralFormCheck has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function pluralFormCheck( string $text, ?array $expectedKeywords ): array {
        [ , $instanceMap ] = UnicodePlural::parsePluralForms( $text );

        foreach ( $instanceMap as $forms ) {
            $actualKeywords = [];
Severity: Minor
Found in src/Validation/Validators/UnicodePluralValidator.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 parseTags has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseTags( $patterns ) {
        $messageKeys = $this->getKeys();

        $matches = [];

Severity: Minor
Found in messagegroups/MessageGroupBase.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( $parameters ): void {
        $this->setHeaders();
        $this->addHelpLink( 'Help:Extension:Translate/Page translation administration' );

        $out = $this->getOutput();
Severity: Minor
Found in src/MessageGroupProcessing/AggregateGroupsSpecialPage.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 getMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMessage( $key, $code ) {
        $cache = $this->getMessageGroupCache( $code );
        if ( $cache->exists() ) {
            $msg = $cache->get( $key );

Severity: Minor
Found in messagegroups/FileBasedMessageGroup.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

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

ve.ce.MWTranslateAnnotationNode = function VeCeMWTranslateAnnotationNode() {
    // Parent constructor
    ve.ce.MWTranslateAnnotationNode.super.apply( this, arguments );
};
Severity: Major
Found in resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js and 2 other locations - About 55 mins to fix
resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js on lines 16..19
resources/src/ve-translate/ve.ui.MWTranslateAnnotationContextItem.js on lines 16..19

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

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

ve.dm.MWTranslateAnnotationNode = function VeDmMWTranslateAnnotationNode() {
    // Parent constructor
    ve.dm.MWTranslateAnnotationNode.super.apply( this, arguments );
};
Severity: Major
Found in resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js and 2 other locations - About 55 mins to fix
resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js on lines 16..19
resources/src/ve-translate/ve.ui.MWTranslateAnnotationContextItem.js on lines 16..19

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

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

ve.ui.MWTranslateAnnotationContextItem = function VeUiMWTranslateAnnotationContextItem() {
    // Parent constructor
    ve.ui.MWTranslateAnnotationContextItem.super.apply( this, arguments );
};
resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js on lines 16..19
resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js on lines 16..19

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

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

                    [
                        'name' => 'only',
                        'label' => 'translate-rcfilters-translations-only-label',
                        'description' => 'translate-rcfilters-translations-only-desc',
                        'cssClassSuffix' => 'only',
Severity: Minor
Found in src/RecentChangesTranslationFilterHookHandler.php and 1 other location - About 55 mins to fix
src/RecentChangesTranslationFilterHookHandler.php on lines 162..173

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

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

                    [
                        'name' => 'site',
                        'label' => 'translate-rcfilters-translations-site-label',
                        'description' => 'translate-rcfilters-translations-site-desc',
                        'cssClassSuffix' => 'site',
Severity: Minor
Found in src/RecentChangesTranslationFilterHookHandler.php and 1 other location - About 55 mins to fix
src/RecentChangesTranslationFilterHookHandler.php on lines 150..161

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

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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        array $priorityLanguages,
        bool $forcePriorityLanguages,
        string $priorityReason,
        array $noFuzzyUnits,
        bool $translateTitle,
Severity: Major
Found in src/PageTranslation/TranslatablePageSettings.php - About 50 mins to fix

    Method updateTranslationPage has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            TranslatablePage $page,
            string $code,
            User $user,
            int $flags,
            string $summary,
    Severity: Major
    Found in src/PageTranslation/Hooks.php - About 50 mins to fix

      Method moveAsynchronously has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              Title $source,
              Title $target,
              bool $moveSubPages,
              User $user,
              string $moveReason,
      Severity: Major
      Found in src/PageTranslation/TranslatableBundleMover.php - About 50 mins to fix

        Method moveSynchronously has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Title $source,
                Title $target,
                array $pagesToMove,
                array $pagesToRedirect,
                User $performer,
        Severity: Major
        Found in src/PageTranslation/TranslatableBundleMover.php - About 50 mins to fix

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

                  ParserOutput $output,
                  WikiPageMessageGroup $group,
                  Language $targetLanguage,
                  Language $sourceLanguage,
                  bool $showOutdated,
          Severity: Major
          Found in src/PageTranslation/TranslationPage.php - About 50 mins to fix

            Method onMovePageTranslationUnits has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    LinkTarget $oldLinkTarget,
                    LinkTarget $newLinkTarget,
                    UserIdentity $userIdentity,
                    int $oldid,
                    int $newid,
            Severity: Major
            Found in src/PageTranslation/Hooks.php - About 50 mins to fix

              Method getPageMoveCollection has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      Title $source,
                      ?Title $target,
                      User $user,
                      string $reason,
                      bool $moveSubPages,
              Severity: Major
              Found in src/PageTranslation/TranslatableBundleMover.php - About 50 mins to fix

                Method onSectionSave has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        WikiPage $wikiPage,
                        User $user,
                        TextContent $content,
                        $summary,
                        $minor,
                Severity: Major
                Found in src/PageTranslation/Hooks.php - About 50 mins to fix

                  Method onChangesListSpecialPageQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $name, &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts
                  Severity: Major
                  Found in src/TranslatorInterface/CleanChangesFilters.php - About 50 mins to fix

                    Method isRenameMissing has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            WebRequest $req,
                            MessageSourceChange $sourceChanges,
                            string $id,
                            string $key,
                            string $language,
                    Severity: Major
                    Found in src/Synchronization/ManageGroupsSpecialPage.php - About 50 mins to fix

                      Method handleRenameSubmit has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              MessageGroup $group,
                              MessageSourceChange $sourceChanges,
                              WebRequest $req,
                              string $language,
                              array &$postponed,
                      Severity: Major
                      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 50 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language