Showing 1,238 of 1,238 total issues
Function validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $value, $alldata ) {
$p = parent::validate( $value, $alldata );
if ( $p !== true ) {
return $p;
- 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
Function runInParallel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function runInParallel( callable $mainThread, callable $forkThread ): void {
// Fork to increase speed with parallelism. Also helps with memory usage if there are leaks.
$pid = -1;
if ( function_exists( 'pcntl_fork' ) ) {
$pid = pcntl_fork();
- 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
Function forAll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function forAll( string ...$prefixedMessagesKeys ): array {
$languages = MessageGroupStats::getLanguages();
$stats = [];
if ( !$prefixedMessagesKeys ) {
- 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
Function execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$services = MediaWikiServices::getInstance();
$db = $services->getDBLoadBalancer()->getConnection( DB_PRIMARY );
$dbGroupIds = $db->newSelectQueryBuilder()
- 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
Function getMessageParameters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getMessageParameters(): array {
$params = parent::getMessageParameters();
$legacy = $this->entry->getParameters();
$type = $this->entry->getFullType();
- 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
Function getContents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getContents( $titles, int $namespace ): array {
$mwServices = MediaWikiServices::getInstance();
$dbr = $mwServices->getConnectionProvider()->getReplicaDatabase();
$revStore = $mwServices->getRevisionStore();
$titleContents = [];
- 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
Function execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): void {
if ( !$this->groupSubscription->isEnabled() ) {
$this->dieWithError( 'apierror-translate-messagegroupsubscription-disabled' );
}
- 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
Function removeFromAggregateGroups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function removeFromAggregateGroups( string $groupId ): void {
// remove the page from aggregate groups, if present in any of them.
$aggregateGroups = MessageGroups::getGroupsByType( AggregateMessageGroup::class );
$this->messageGroupMetadata->preloadGroups( array_keys( $aggregateGroups ), __METHOD__ );
foreach ( $aggregateGroups as $group ) {
- 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
Function getTranslationUnitPagesByTitle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getTranslationUnitPagesByTitle( PageReference $title, ?string $code = null ): array {
$mwServices = MediaWikiServices::getInstance();
$dbw = $mwServices->getDBLoadBalancer()->getConnection( DB_PRIMARY );
$base = $mwServices->getTitleFormatter()->getPrefixedDBkey( $title );
- 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
Function getMessageContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getMessageContent( MessageHandle $handle ) {
$groupId = Services::getInstance()->getMessageIndex()->getPrimaryGroupId( $handle );
if ( $groupId === null ) {
return null;
}
- 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
Function getBodyMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getBodyMessage() {
$type = $this->event->getType();
if ( $type === 'translate-mgs-message-added' ) {
if ( $this->isBundled() ) {
$events = $this->getBundledEvents();
- 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
Function getIssues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
$issues = new ValidationIssues();
// We skip certain validations if we don't know the expected keywords
$expectedKeywords = UnicodePlural::getPluralKeywords( $targetLanguage );
- 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
Function getInsertablesSuggester
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getInsertablesSuggester() {
$suggesters = [];
$insertableConf = $this->getFromConf( 'INSERTABLES' ) ?? [];
foreach ( $insertableConf as $config ) {
- 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
Function getIssues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
$issues = new ValidationIssues();
$pluralRule = GettextPlural::getPluralRule( $targetLanguage );
// Skip validation for languages for which we do not know the plural rule
- 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
Function getMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getMessage( $key, $code, $flags = IDBAccessObject::READ_LATEST ) {
if ( $this->isSourceLanguage( $code ) ) {
$stuff = $this->load( $code );
$title = Title::newFromText( $key );
- 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
Function processGettextPluralMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function processGettextPluralMessage( ?int $pluralCount, string $section ): string {
$actualForms = [];
for ( $i = 0; $i < $pluralCount; $i++ ) {
$match = $this->expectKeyword( "msgstr\\[$i\\]", $section );
- 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
Function doGettextHeader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function doGettextHeader( MessageCollection $collection, array $template ): string {
global $wgSitename;
$code = $collection->code;
$name = Utilities::getLanguageName( $code );
- 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
Function isContentEqual
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isContentEqual( ?string $a, ?string $b ): bool {
if ( $a === $b ) {
return true;
}
- 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"