Showing 11,545 of 11,545 total issues
Function sendResponseHeaders
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function sendResponseHeaders(
Context $context, $etag, $errors, array $extra = []
): void {
HeaderCallback::warnIfHeadersSent();
- 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 beginAccountLink
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function beginAccountLink( User $user, array $reqs, $returnToUrl ) {
$session = $this->request->getSession();
$session->remove( self::ACCOUNT_LINK_STATE );
if ( !$this->canLinkAccounts() ) {
- 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 validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $name, $value, array $settings, array $options ) {
if ( !is_array( $value ) ) {
// Message used: paramvalidator-notarray
$this->failure( 'notarray', $name, $value, $settings, $options );
}
- 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 setArrayHookHandler
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function setArrayHookHandler(
array $callback,
array $hookHandlersAttr,
string $name,
string $path
- 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 generateUndoEditSummary
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function generateUndoEditSummary( ?RevisionRecord $oldrev, int $undo,
?RevisionRecord $undorev, MediaWikiServices $services
) {
// If we just undid one rev, use an autosummary
$firstrev = $this->revisionStore->getNextRevision( $oldrev );
- 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 extractHooks
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function extractHooks( array $info, string $path ) {
$extName = $info['name'];
if ( isset( $info['Hooks'] ) ) {
$hookHandlersAttr = [];
foreach ( $info['HookHandlers'] ?? [] as $name => $def ) {
- 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 addUserConfigPageInfo
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function addUserConfigPageInfo(
IntroMessageList $messages,
MessageLocalizer $localizer,
Title $title,
Authority $performer,
- 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 writeRevision
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function writeRevision( $row, $slotRows = null ) {
$rev = $this->getRevisionStore()->newRevisionFromRowAndSlots(
$row,
$slotRows,
0,
- 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 find
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function find( $className ): ?string {
global $wgAutoloadLocalClasses, $wgAutoloadClasses;
// NOTE: $wgAutoloadClasses is supported for compatibility with old-style extension
// registration files.
- 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 saveRevision
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function saveRevision( CommentStoreComment $summary, int $flags = 0 ) {
$this->setFlags( $flags );
if ( $this->wasCommitted() ) {
throw new RuntimeException(
- 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 combineSlotOutput
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function combineSlotOutput( RenderedRevision $rrev, ParserOptions $options, array $hints = [] ) {
$revision = $rrev->getRevision();
$slots = $revision->getSlots()->getSlots();
$withHtml = $hints['generate-html'] ?? 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"
Further reading
Function import
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function import( ImportableUploadRevision $importableRevision ) {
# Construct a file
$archiveName = $importableRevision->getArchiveName();
$localRepo = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo();
if ( $archiveName ) {
- 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 newRevisionFromRowAndSlots
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function newRevisionFromRowAndSlots(
stdClass $row,
$slots,
int $queryFlags = 0,
?PageIdentity $page = 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 checkRange
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function checkRange( $value, $name, $origValue, array $settings, array $options ) {
$min = $settings[self::PARAM_MIN] ?? null;
$max1 = $settings[self::PARAM_MAX] ?? null;
$max2 = $settings[self::PARAM_MAX2] ?? $max1;
$err = false;
- 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 findNodeIndexForPosition
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function findNodeIndexForPosition( $position, $ring ) {
$count = count( $ring );
if ( $count === 0 ) {
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 diff
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function diff( $from_lines, $to_lines ) {
// Diff and store locally
$this->diffInternal( $from_lines, $to_lines );
// Merge edits when possible
- 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 deserialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function deserialize( $json, string $expectedClass = null ) {
Assert::parameterType( [ 'stdClass', 'array', 'string' ], $json, '$json' );
Assert::precondition(
!$expectedClass || is_subclass_of( $expectedClass, JsonDeserializable::class ),
'$expectedClass parameter must be subclass of JsonDeserializable, got ' . $expectedClass
- 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 doLockByType
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
final protected function doLockByType( array $pathsByType ) {
$status = StatusValue::newGood();
$pathsByTypeByBucket = []; // (bucket => type => paths)
// Get locks that need to be acquired (buckets => locks)...
- 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 __construct
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( array $config ) {
parent::__construct( $config );
$this->syncChecks = $config['syncChecks'] ?? self::CHECK_SIZE;
$this->autoResync = $config['autoResync'] ?? false;
$this->asyncWrites = isset( $config['replication'] ) && $config['replication'] === 'async';
- 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 primeFileCache
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
final protected function primeFileCache( array $items ) {
/** @noinspection PhpUnusedLocalVariableInspection */
$ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
$paths = []; // list of storage paths
- 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"