Method showIndirectLinks
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showIndirectLinks(
$level, $target, $limit, $offsetNamespace = 0, $offsetPageID = 0, $dir = 'next'
) {
$out = $this->getOutput();
$dbr = $this->dbProvider->getReplicaDatabase();
Function showIndirectLinks
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
private function showIndirectLinks(
$level, $target, $limit, $offsetNamespace = 0, $offsetPageID = 0, $dir = 'next'
) {
$out = $this->getOutput();
$dbr = $this->dbProvider->getReplicaDatabase();
- 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
File SpecialWhatLinksHere.php
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Implements Special:Whatlinkshere
*
* This program is free software; you can redistribute it and/or modify
Method listItem
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function listItem( $row, $nt, $target, $notClose = false ) {
$dirmark = $this->getLanguage()->getDirMark();
if ( $row->rd_from ) {
$query = [ 'redirect' => 'no' ];
Method getFormFields
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFormFields() {
$this->addHelpLink( 'Help:What links here' );
$this->getOutput()->addModuleStyles( 'mediawiki.special' );
$fields = [
Consider simplifying this complex logical expression. Open
if ( ( !$fetchredirs || !$rdRes->numRows() )
// @phan-suppress-next-line PhanPossiblyUndeclaredVariable $plRes is declared when fetching links
&& ( $hidelinks || !$plRes->numRows() )
// @phan-suppress-next-line PhanPossiblyUndeclaredVariable $tlRes is declared when fetching trans
&& ( $hidetrans || !$tlRes->numRows() )
Method onSuccess
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onSuccess() {
$opts = new FormOptions();
$opts->add( 'namespace', null, FormOptions::INTNULL );
$opts->add( 'limit', null, FormOptions::INTNULL );
Method parseOffsetAndDir
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseOffsetAndDir( FormOptions $opts ): array {
$from = $opts->getValue( 'from' );
$opts->reset( 'from' );
if ( $from ) {
Method wlhLink
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function wlhLink( Title $target, $text, $editText ) {
static $title = null;
if ( $title === null ) {
$title = $this->getPageTitle();
}
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
IConnectionProvider $dbProvider,
LinkBatchFactory $linkBatchFactory,
IContentHandlerFactory $contentHandlerFactory,
SearchEngineFactory $searchEngineFactory,
NamespaceInfo $namespaceInfo,
Function parseOffsetAndDir
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function parseOffsetAndDir( FormOptions $opts ): array {
$from = $opts->getValue( 'from' );
$opts->reset( 'from' );
if ( $from ) {
- 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
Method showIndirectLinks
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$level, $target, $limit, $offsetNamespace = 0, $offsetPageID = 0, $dir = 'next'
Function listItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function listItem( $row, $nt, $target, $notClose = false ) {
$dirmark = $this->getLanguage()->getDirMark();
if ( $row->rd_from ) {
$query = [ 'redirect' => 'no' ];
- 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
Avoid too many return
statements within this method. Open
return 0;