Showing 11,545 of 11,545 total issues
Function isValidFileMove
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function isValidFileMove() {
$status = new Status();
if ( !$this->newTitle->inNamespace( NS_FILE ) ) {
// No need for further errors about the target filename being wrong
- 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 getSessionFromInfo
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getSessionFromInfo( SessionInfo $info, WebRequest $request ) {
// @codeCoverageIgnoreStart
if ( defined( 'MW_NO_SESSION' ) ) {
$ep = defined( 'MW_ENTRY_POINT' ) ? MW_ENTRY_POINT : 'this';
- 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 logPotentialSessionLeakage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function logPotentialSessionLeakage( Session $session = null ) {
$proxyLookup = MediaWikiServices::getInstance()->getProxyLookup();
$session = $session ?: self::getGlobalSession();
$suspiciousIpExpiry = $this->config->get( MainConfigNames::SuspiciousIpExpiry );
- 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 moveUnsafe
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function moveUnsafe( UserIdentity $user, $reason, $createRedirect, array $changeTags ) {
$status = Status::newGood();
// TODO: make hooks accept UserIdentity
$userObj = $this->userFactory->newFromUserIdentity( $user );
- 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 runPreDeleteHooks
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function runPreDeleteHooks( WikiPage $page, string &$reason ): Status {
$status = Status::newGood();
$legacyDeleter = $this->userFactory->newFromAuthority( $this->deleter );
if ( !$this->hookRunner->onArticleDelete(
- 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 replaceSectionAtRev
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function replaceSectionAtRev( $sectionId, Content $sectionContent,
$sectionTitle = '', $baseRevId = null
) {
if ( strval( $sectionId ) === '' ) {
// Whole-page edit; let the whole text through
- 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 loadOOUIDefinition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function loadOOUIDefinition( $theme, $unused ): array {
// This is shared between instances of this class, so we only have to load the JSON files once
static $data = [];
if ( !isset( $data[$theme] ) ) {
- 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 run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function run( string $hook, array $args = [], array $options = [] ): bool {
$checkDeprecation = isset( $options['deprecatedVersion'] );
$abortable = $options['abortable'] ?? true;
foreach ( $this->getHandlers( $hook, $options ) as $handler ) {
- 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 makeObjectSchema
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function makeObjectSchema(
array $required = [], array $optional = [], $additional = false
): array {
$schema = [ 'type' => 'object' ];
- 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 composeCommonMailtext
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function composeCommonMailtext( MessageCache $messageCache ) {
$services = MediaWikiServices::getInstance();
$config = $services->getMainConfig();
$userOptionsLookup = $services->getUserOptionsLookup();
$urlUtils = $services->getUrlUtils();
- 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 shouldExclude
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function shouldExclude( $name ) {
if ( $name === '-total' ) {
return true;
}
if ( !empty( $this->params['include'] ) ) {
- 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 getPreviewLimitReport
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function getPreviewLimitReport( ParserOutput $output = null ) {
if ( !$output || !$output->getLimitReportData() ) {
return '';
}
- 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 convertGrammar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
if ( isset( $grammarForms['hy'][$case][$word] ) ) {
return $grammarForms['hy'][$case][$word];
- 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 outputVariesOnRevisionMetaData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function outputVariesOnRevisionMetaData(
ParserOutput $parserOutput,
$actualPageId,
$actualRevId,
$actualRevTimestamp
- 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 mapDiffPrevNext
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function mapDiffPrevNext( $old, $new ) {
if ( $new === 'prev' ) {
// Show diff between revision $old and the previous one. Get previous one from DB.
$newid = intval( $old );
$oldid = 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 addMappings
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function addMappings( $mapArray, &$A2B, &$B2A, $exactCase = false, $prePat = '', $postPat = '' ) {
foreach ( $mapArray as $WordA => $WordB ) {
if ( !$exactCase ) {
$ucA = $this->myUc( $WordA );
$ucWordA = $this->myUcWord( $WordA );
- 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 doRenderBatch
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function doRenderBatch( string $oldText, string $newText, array $formats ): array {
if ( $this->useMultiFormat ) {
if ( !$this->formatOptions ) {
/** @var array $result */
$result = wikidiff2_multi_format_diff(
- 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 guessOriginalRevisionId
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function guessOriginalRevisionId() {
if ( !$this->originalRevisionId ) {
if ( $this->revertAfterRevId ) {
$this->setOriginalRevision( $this->revertAfterRevId );
} elseif ( $this->newestRevertedRevId ) {
- 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 getPage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getPage( ?int $pageId, ?int $revId, int $queryFlags = IDBAccessObject::READ_NORMAL ) {
if ( !$pageId && !$revId ) {
throw new InvalidArgumentException( '$pageId and $revId cannot both be 0 or 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 getParamInfo
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getParamInfo( $name, $settings, array $options ) {
$settings = $this->normalizeSettings( $settings );
$typeDef = $this->getTypeDef( $settings[self::PARAM_TYPE] );
$info = [];
- 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"