Showing 11,498 of 11,498 total issues
Function readAndDecode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function readAndDecode( SettingsFormat $format ): array {
$contents = AtEase::quietCall( 'file_get_contents', $this->path );
if ( $contents === false ) {
if ( !is_readable( $this->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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $params = [] ) {
parent::__construct();
if ( isset( $params['sessionCookieName'] ) ) {
if ( !is_string( $params['sessionCookieName'] ) ) {
- 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 loadLocalSettingsFile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function loadLocalSettingsFile( string $file ) {
// If $file is not a PHP file, just load it as a data file.
if ( !str_ends_with( $file, '.php' ) ) {
$this->settingsBuilder->loadFile( $file );
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 newFromTitle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function newFromTitle( PageIdentity $pageIdentity ): WikiPage {
if ( $pageIdentity instanceof WikiPage ) {
return $pageIdentity;
}
- 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 deleteUnsafe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function deleteUnsafe( string $reason ): Status {
$this->setDeletionAttempted();
$origReason = $reason;
$hookStatus = $this->runPreDeleteHooks( $this->page, $reason );
if ( !$hookStatus->isGood() ) {
- 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 showDiffPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function showDiffPage() {
$context = $this->getContext();
$outputPage = $context->getOutput();
$outputPage->addBodyClasses( 'mw-article-diff' );
$request = $context->getRequest();
- 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 makeMetadataTable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makeMetadataTable( $metadata ) {
$r = $this->getContext()->msg( 'metadata-help' )->plain();
// Initial state of collapsible rows is collapsed
// see mediawiki.action.view.filepage.less and mediawiki.action.view.metadata module.
$r .= "<table id=\"mw_metadata\" class=\"mw_metadata collapsed\">\n";
- 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 printSharedImageText
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function printSharedImageText() {
$out = $this->getContext()->getOutput();
$this->loadFile();
$descUrl = $this->getFile()->getDescriptionUrl();
- 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 closeShowCategory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function closeShowCategory() {
// Use these as defaults for back compat --catrope
$request = $this->getContext()->getRequest();
$oldFrom = $request->getVal( 'from' );
$oldUntil = $request->getVal( 'until' );
- 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 renderRevision
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function renderRevision(
PageRecord $page,
ParserOptions $parserOptions,
RevisionRecord $revision,
int $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 tryFileCache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function tryFileCache() {
static $called = false;
if ( $called ) {
wfDebug( "Article::tryFileCache(): called twice!?" );
- 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 getBlobs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getBlobs( array $modules, $lang ) {
// Each cache key for a message blob by module name and language code also has a generic
// check key without language code. This is used to invalidate any and all language subkeys
// that exist for a module from the updateMessage() method.
$checkKeys = [
- 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 getCombinedVersion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getCombinedVersion( Context $context, array $moduleNames ) {
if ( !$moduleNames ) {
return '';
}
$hashes = [];
- 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 replaceSectionContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function replaceSectionContent(
$sectionId, Content $sectionContent, $sectionTitle = '', $edittime = null
) {
$baseRevId = null;
if ( $edittime && $sectionId !== 'new' ) {
- 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 getModule
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getModule( $name ) {
if ( !isset( $this->modules[$name] ) ) {
if ( !isset( $this->moduleInfos[$name] ) ) {
// No such module
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 fetchTitleInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected static function fetchTitleInfo( IReadableDatabase $db, array $pages, $fname = __METHOD__ ) {
$titleInfo = [];
$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
$batch = $linkBatchFactory->newLinkBatch();
foreach ( $pages as $titleText ) {
- 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 loadLastEdit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function loadLastEdit() {
if ( $this->mLastRevision !== null ) {
return; // already loaded
}
- 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 getContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getContent( $titleText, Context $context ) {
$pageStore = MediaWikiServices::getInstance()->getPageStore();
$title = $pageStore->getPageByText( $titleText );
if ( !$title ) {
return null; // Bad 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 findUniqueTags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function findUniqueTags( DOMNode $rootNode, array $tagNames ): array {
$nodes = [];
foreach ( $rootNode->childNodes as $node ) {
$tagName = strtolower( $node->nodeName );
if ( in_array( $tagName, $tagNames ) ) {
- 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 getStyles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getStyles( Context $context ) {
$styles = $this->readStyleFiles(
$this->getStyleFiles( $context ),
$context
);
- 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"