Showing 11,498 of 11,498 total issues
Function execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
if ( !$this->getUser()->isRegistered() ) {
$this->dieWithError( 'apierror-mustbeloggedin-uploadstash', 'notloggedin' );
}
- 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 matchUrlPattern
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function matchUrlPattern( $url, array $patterns ) {
if ( isset( $patterns[ $url ] ) ) {
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"
Further reading
Function executeGenderCacheFromResultWrapper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function executeGenderCacheFromResultWrapper(
IResultWrapper $res, $fname = __METHOD__, $fieldPrefix = 'page'
) {
if ( !$res->numRows() ) {
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 getAllowedParams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getAllowedParams() {
$slotRoles = $this->slotRoleRegistry->getKnownRoles();
sort( $slotRoles, SORT_STRING );
// Parameters for the 'from' and 'to' content
- 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 handleParamNormalization
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function handleParamNormalization( $paramName, $value, $rawValue ) {
parent::handleParamNormalization( $paramName, $value, $rawValue );
if ( $paramName === 'titles' ) {
// For the 'titles' parameter, we want to split it like ApiBase would
- 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 addRequestedFields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function addRequestedFields( $force = [] ) {
$result = $this->getResult();
$requestid = $this->getParameter( 'requestid' );
if ( $requestid !== 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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
$wikiPage = $this->getTitleOrPageId( $params );
$title = $wikiPage->getTitle();
$this->getErrorFormatter()->setContextTitle( $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 setCacheMode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setCacheMode( $mode ) {
if ( !in_array( $mode, [ 'private', 'public', 'anon-public-user-private' ] ) ) {
wfDebug( __METHOD__ . ": unrecognised cache mode \"$mode\"" );
// Ignore for forwards-compatibility
- 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 setupExternalResponse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function setupExternalResponse( $module, $params ) {
$validMethods = [ 'GET', 'HEAD', 'POST', 'OPTIONS' ];
$request = $this->getRequest();
if ( !in_array( $request->getMethod(), $validMethods ) ) {
- 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 fixHelpLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function fixHelpLinks( $html, $helptitle = null, $localModules = [] ) {
return HtmlHelper::modifyElements(
$html,
static function ( SerializerNode $node ): bool {
return $node->name === 'a'
- 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 getBlockDetails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getBlockDetails(
Block $block,
$language = null
) {
$language ??= $this->getLanguage();
- 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() {
// Check if change language feature is enabled
if ( !$this->getConfig()->get( MainConfigNames::PageLanguageUseDB ) ) {
$this->dieWithError( 'apierror-pagelang-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 getWatchlistValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getWatchlistValue(
string $watchlist,
Title $title,
User $user,
?string $userOption = 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 appendLanguageVariants
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function appendLanguageVariants( $property ) {
$langNames = $this->languageConverterFactory->isConversionDisabled() ? [] :
LanguageConverter::$languagesWithVariants;
sort( $langNames );
- 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 appendDbReplLagInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function appendDbReplLagInfo( $property, $includeAll ) {
$data = [];
$showHostnames = $this->getConfig()->get( MainConfigNames::ShowHostnames );
if ( $includeAll ) {
if ( !$showHostnames ) {
- 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 modifyTableSpecificBlobsForAdd
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function modifyTableSpecificBlobsForAdd(
IDatabase $db,
string $ptable,
float $mtime,
array $argsByKey,
- 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 showConvenienceLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function showConvenienceLinks() {
$linkRenderer = $this->getLinkRenderer();
# Give a link to the logs/hist for this page
if ( $this->targetObj ) {
// Also set header tabs to be for the target.
- 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 buildMultiUpsertSetForOverwrite
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildMultiUpsertSetForOverwrite( IDatabase $db, string $mt ) {
$expressionsByColumn = [
'value' => $db->buildExcludedValue( 'value' ),
'exptime' => $db->buildExcludedValue( 'exptime' )
];
- 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 addBlockInfoToStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function addBlockInfoToStatus( StatusValue $status, Authority $user = null ) {
if ( $status instanceof PermissionStatus ) {
$block = $status->getBlock();
} else {
$user = $user ?: $this->getAuthority();
- 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 tryShowFile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function tryShowFile( $archiveName ) {
$repo = $this->repoGroup->getLocalRepo();
$oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
$oimage->load();
// Check if user is allowed to see this file
- 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"