Showing 691 of 718 total issues
Function reformat
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function reformat( array $problems ): array {
$clean = [];
$indexBaseName = $this->getSearchConfig()->get( SearchConfig::INDEX_BASE_NAME );
// Generic connection for resolving index names, its always the same everywhere
$connection = Connection::getPool( $this->getSearchConfig() );
- 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 sendDeletes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function sendDeletes( $docIds, $indexSuffix = null ) {
if ( $indexSuffix === null ) {
$indexes = $this->connection->getAllIndexSuffixes( Connection::PAGE_DOC_TYPE );
} else {
$indexes = [ $indexSuffix ];
- 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 intersect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function intersect( CrossSearchStrategy $other ) {
if ( $other === self::hostWikiOnlyStrategy() || $this === self::hostWikiOnlyStrategy() ) {
return self::hostWikiOnlyStrategy();
}
$crossL = $other->crossLanguageSearchSupported && $this->crossLanguageSearchSupported;
- 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 onLinksUpdateComplete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function onLinksUpdateComplete( $linksUpdate, $ticket ) {
if ( !$this->isEnabled() ) {
return;
}
// defer processing the LinksUpdateComplete hook until other hooks tagged in PageChangeTracker
- 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 preparePageReferencesForLinksUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function preparePageReferencesForLinksUpdate( $pageReferences, int $max, $excludeBadUTF = false ) {
$pageReferences = self::pickFromArray( $pageReferences, $max );
$dBKeys = [];
foreach ( $pageReferences as $pageReference ) {
$title = Title::newFromPageReference( $pageReference );
- 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 getDetectors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getDetectors() {
$detectors = [];
foreach ( $this->config->get( 'CirrusSearchLanguageDetectors' ) as $name => $klass ) {
if ( !class_exists( $klass ) ) {
LoggerFactory::getInstance( 'CirrusSearch' )->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"
Further reading
Function prefixSearch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function prefixSearch( $search, $variants ) {
$searcher = $this->makeSearcher();
if ( $search ) {
$searcher->setResultsType( new FancyTitleResultsType( 'prefix' ) );
- 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 buildLogMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function buildLogMessage( RequestLog $log, array $context ) {
$message = $log->getDescription();
$message .= " against {index} took {tookMs} millis";
if ( isset( $context['elasticTookMs'] ) ) {
$message .= " and {elasticTookMs} Elasticsearch millis";
- 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 getProfiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getProfiles( $profileType, User $user = null ) {
$profileService = $this->config->getProfileService();
$serviceProfileType = null;
switch ( $profileType ) {
case SearchEngine::COMPLETION_PROFILE_TYPE:
- 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 checkExisitingPage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function checkExisitingPage( $docId, $pageId, $page, array $fromIndex ) {
$inIndex = $fromIndex !== [];
if ( $this->checkIfRedirect( $page ) ) {
if ( $inIndex ) {
foreach ( $fromIndex as $indexInfo ) {
- 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 completionSearchBackend
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function completionSearchBackend( $search ) {
if ( in_array( NS_SPECIAL, $this->namespaces ) ) {
// delegate special search to parent
return parent::completionSearchBackend( $search );
}
- 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 getAllIndexSuffixes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAllIndexSuffixes( $documentType = self::PAGE_DOC_TYPE ) {
Assert::parameter( $documentType === null || isset( self::SUFFIX_MAPPING[$documentType] ),
'$documentType', "Unknown mapping type $documentType" );
$indexSuffixes = [];
- 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 loadProfileByName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function loadProfileByName( $type, $name, $failIfMissing = true ) {
if ( isset( $this->repositories[$type] ) ) {
$repos = $this->repositories[$type];
foreach ( $repos as $repo ) {
$prof = $repo->getProfile( $name );
- 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 getIndex
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getIndex(): \Elastica\Index {
if ( $this->index ) {
return $this->index;
} else {
$indexBaseName = $this->indexBaseName;
- 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 getAliasedIndexName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getAliasedIndexName() {
// FIXME: Elastica seems to have trouble parsing the error reason
// for this endpoint. Running a simple HEAD first to check if it
// exists
$resp = $this->client->request( '_alias/' . self::INDEX_NAME, \Elastica\Request::HEAD, [] );
- 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 transformOneResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function transformOneResult( \Elastica\Result $result ) {
$source = $result->getSource();
if ( $source['namespace'] === NS_FILE ) {
if ( in_array( $source['title'], $this->fileTitles ) ) {
if ( $this->deduplicate ) {
- 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 getPrefixSearchRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getPrefixSearchRequest( $term, $variants ) {
$namespaces = $this->searchContext->getNamespaces();
if ( $namespaces === null ) {
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 build
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function build() {
$rescores = [];
foreach ( $this->profile['rescore'] as $rescoreDef ) {
$windowSize = $this->windowSize( $rescoreDef );
if ( $windowSize <= 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 buildFullTextSearch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function buildFullTextSearch( $term ) {
// Convert the unicode character 'ideographic whitespace' into standard
// whitespace. Cirrussearch treats them both as normal whitespace, but
// the preceding isn't appropriately trimmed.
// No searching for nothing! That takes forever!
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $namespaces, $weight, NamespaceInfo $namespaceInfo = null ) {
parent::__construct( $config, $weight );
$this->namespaceInfo = $namespaceInfo ?: MediaWikiServices::getInstance()->getNamespaceInfo();
$this->namespacesToBoost =
- 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"