Function addMessageUpdateChanges
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function addMessageUpdateChanges(
FileBasedMessageGroup $group,
string $language,
MessageSourceChange $changes,
int $reason,
- Read upRead up
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
File ExternalMessageSourceStateComparator.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Synchronization;
Method addMessageUpdateChanges
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addMessageUpdateChanges(
FileBasedMessageGroup $group,
string $language,
MessageSourceChange $changes,
int $reason,
Method checkNonSourceAdditionsForRename
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkNonSourceAdditionsForRename(
MessageSourceChange $changes,
string $sourceLanguage,
string $targetLanguage,
MessageCollection $wiki,
Function checkNonSourceAdditionsForRename
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function checkNonSourceAdditionsForRename(
MessageSourceChange $changes,
string $sourceLanguage,
string $targetLanguage,
MessageCollection $wiki,
- Read upRead up
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 hasCacheEntry
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function hasCacheEntry(
MessageGroupCache $cache,
MessageCollection $collection,
string $messageKey
): bool {
Method addNonSourceRenames
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageSourceChange $changes,
string $key,
string $renameKey,
string $sourceContent,
string $wikiContent,
Function findAndMarkSourceRenames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function findAndMarkSourceRenames( MessageSourceChange $changes, string $sourceLanguage ): void {
// Now check for renames. To identify renames we need to compare
// the contents of the added messages with the deleted ones and
// identify messages that match.
$deletions = $changes->getDeletions( $sourceLanguage );
- Read upRead up
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 checkNonSourceAdditionsForRename
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageSourceChange $changes,
string $sourceLanguage,
string $targetLanguage,
MessageCollection $wiki,
array $wikiKeys
Method addMessageUpdateChanges
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
FileBasedMessageGroup $group,
string $language,
MessageSourceChange $changes,
int $reason,
MessageGroupCache $cache