wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function save(
        Title $pageTitle,
        RevisionRecord $revisionRecord,
        MessageBundleContent $content
    ): void {
Severity: Minor
Found in src/MessageBundleTranslation/MessageBundleStore.php - About 35 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 removeFromCache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function removeFromCache( Title $title ): void {
        $config = MediaWikiServices::getInstance()->getMainConfig();

        if ( !$config->get( 'TranslateGroupSynchronizationCache' ) ) {
            return;
Severity: Minor
Found in src/Synchronization/UpdateMessageJob.php - About 35 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 getTalkPages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getTalkPages( array $pages ): array {
        $lb = $this->linkBatchFactory->newLinkBatch();
        $talkPageList = [];

        foreach ( $pages as $page ) {
Severity: Minor
Found in src/MessageGroupProcessing/SubpageListBuilder.php - About 35 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 getLatestRevisionsForTags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLatestRevisionsForTags( PageIdentity $identity, string ...$tags ): ?array {
        if ( !$identity->exists() ) {
            return null;
        }

Severity: Minor
Found in src/MessageGroupProcessing/RevTagStore.php - About 35 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 queueUpdates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function queueUpdates( int $flags ): void {
        $mwInstance = MediaWikiServices::getInstance();
        if ( self::$updates === [] || $mwInstance->getReadOnlyMode()->isReadOnly() ) {
            return;
        }
Severity: Minor
Found in src/Statistics/MessageGroupStats.php - About 35 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 getPluralRule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getPluralRule( $code ) {
        global $wgTranslateDocumentationLanguageCode;

        if ( $code === $wgTranslateDocumentationLanguageCode ) {
            return 'nplurals=1; plural=0;';
Severity: Minor
Found in src/Utilities/GettextPlural.php - About 35 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 getTable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getTable( array $stats ): string {
        $table = $this->table;
        $out = '';

        // This avoids a database query per translatable page, which would be caused by
Severity: Minor
Found in src/Statistics/LanguageStatsSpecialPage.php - About 35 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 forItemInternal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function forItemInternal(
        array &$stats,
        MessageGroup $group,
        string $languageCode,
        int $flags
Severity: Minor
Found in src/Statistics/MessageGroupStats.php - About 35 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 isAuthorExcluded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function isAuthorExcluded( string $groupId, string $languageCode, string $username ): bool {
        $hash = "$groupId;$languageCode;$username";
        $authorExclusionList = $this->getTranslateAuthorExclusionList();
        $excluded = false;

Severity: Minor
Found in src/Utilities/ConfigHelper.php - About 35 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 moveMetadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function moveMetadata( string $oldGroupId, string $newGroupId ): void {
        // Make the changes in aggregate groups metadata, if present in any of them.
        $aggregateGroups = MessageGroups::getGroupsByType( AggregateMessageGroup::class );
        $this->messageGroupMetadata->preloadGroups( array_keys( $aggregateGroups ), __METHOD__ );

Severity: Minor
Found in src/MessageGroupProcessing/TranslatablePageStore.php - About 35 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 getLanguagesFromHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getLanguagesFromHeader( array $csvHeader ): Status {
        if ( count( $csvHeader ) < 2 ) {
            return Status::newFatal(
                'CSV has < 2 columns. Assuming that there are no languages to import'
            );
Severity: Minor
Found in src/MessageGroupProcessing/CsvTranslationImporter.php - About 35 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 filterValidations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function filterValidations(
        string $messageKey,
        ValidationIssues $issues,
        string $targetLanguage
    ): ValidationIssues {
Severity: Minor
Found in src/Validation/ValidationRunner.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    protected function writeReal( MessageCollection $collection ): string {
        $messages = [];
        $mangler = $this->group->getMangler();

        /** @var Message $m */
Severity: Minor
Found in src/FileFormatSupport/AmdFormat.php - About 35 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 pluralFormsCheck has a Cognitive Complexity of 7 (exceeds 5 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 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    protected function writeReal( MessageCollection $collection ): string {
        $header = $this->doHeader( $collection );
        $header .= $this->doAuthors( $collection );
        $header .= "\n";

Severity: Minor
Found in src/FileFormatSupport/JavaFormat.php - About 35 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 getIssues has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
        $issues = new ValidationIssues();

        $definition = $message->definition();
        $translation = $message->translation();
Severity: Minor
Found in src/Validation/Validators/MediaWikiTimeListValidator.php - About 35 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 getMangler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMangler() {
        if ( $this->mangler === null ) {
            $class = $this->getFromConf( 'MANGLER', 'class' ) ?? StringMatcher::class;

            if ( $class === 'StringMatcher' || $class === StringMatcher::class ) {
Severity: Minor
Found in messagegroups/MessageGroupBase.php - About 35 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 mapCode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function mapCode( $code ) {
        if ( !isset( $this->conf['FILES']['codeMap'] ) ) {
            return $code;
        }

Severity: Minor
Found in messagegroups/FileBasedMessageGroup.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    protected function writeReal( MessageCollection $collection ): string {
        $template = $this->read( $collection->getLanguage() ) ?: [];
        $authors = $this->filterAuthors( $collection->getAuthors(), $collection->getLanguage() );
        $messages = [];

Severity: Minor
Found in src/FileFormatSupport/JsonFormat.php - About 35 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 readFromVariable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function readFromVariable( string $data ): array {
        $parts = explode( self::PART_SEPARATOR, $data );

        if ( count( $parts ) !== 2 ) {
            throw new InvalidArgumentException( 'Wrong number of parts.' );
Severity: Minor
Found in src/FileFormatSupport/SimpleFormat.php - About 35 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