Showing 691 of 718 total issues
Function loadConfigFromAPI
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function loadConfigFromAPI( $wikis, array $hashConfigFlags, $fallbackConfig ) {
$endpoints = [];
foreach ( $wikis as $prefix => $wiki ) {
$iw = $this->interwikiLookup->fetch( $prefix );
if ( !$iw || !$this->useConfigDumpApi || !$iw->isLocal() ) {
- 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 buildTagWeightsFromLegacyParameters
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function buildTagWeightsFromLegacyParameters( $tagNames = null, $tagWeights = null ) {
Assert::parameterType(
[
'string',
'array',
- 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 getOverriddenFactor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function getOverriddenFactor( $value ) {
if ( is_array( $value ) ) {
$returnValue = (float)$value['value'];
if ( isset( $value['config_override'] ) ) {
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $weight, $profile ) {
parent::__construct( $config, $weight );
if ( isset( $profile['impact'] ) ) {
$this->impact = $this->getOverriddenFactor( $profile['impact'] );
- 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 getSupportedProfile
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function getSupportedProfile( $profileName ) {
$profile = $this->context->getConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::RESCORE, $profileName );
if ( !is_array( $profile ) ) {
- 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 explain
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def explain(
self,
problem: Problem,
es_state: Mapping[Tuple[str, str], ElasticsearchState],
) -> Optional[str]:
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$this->indexSuffix = $this->getBackCompatOption( 'indexSuffix', 'indexType' );
$this->indexBaseName = $this->getOption( 'baseName',
- 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 recycle
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function recycle() {
$this->log( "Recycling index {$this->getIndex()->getName()}\n" );
$this->recycle = true;
$indexedDocs = $this->indexData();
// This is fragile... hopefully most of the docs will be deleted from the old segments
Method __construct
has 17 arguments (exceeds 4 allowed). Consider refactoring. Open
ParsedQuery $parsedQuery,
array $initialNamespaces,
CrossSearchStrategy $initialCrosswikiStrategy,
array $contextualFilters,
$searchEngineEntryPoint,
Method sendOtherIndexUpdates
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendOtherIndexUpdates( $localSite, $indexName, array $otherActions, $batchSize = 30 ) {
$client = $this->connection->getClient();
$status = Status::newGood();
foreach ( array_chunk( $otherActions, $batchSize ) as $updates ) {
'@phan-var array[] $updates';
File ElasticaErrorHandler.php
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use Elastica\Exception\Bulk\ResponseException as BulkResponseException;
Function sendWeightedTagsUpdate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function sendWeightedTagsUpdate(
string $indexSuffix,
string $tagPrefix,
array $tagWeights,
int $batchSize = 30
- 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 searchTextReal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function searchTextReal( SearchQuery $query ) {
$searcher = $this->makeSearcher( $query->getSearchConfig() );
$status = $searcher->search( $query );
$this->lastSearchMetrics = $searcher->getSearchMetrics();
if ( !$status->isOK() ) {
- 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 enableGlobalCustomFilters
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function enableGlobalCustomFilters( array $config, string $language,
array $customFilters, array $installedPlugins ) {
foreach ( $customFilters as $filterName => $gcfInfo ) {
if ( !$gcfInfo->languageCheck( $language ) ) {
continue;
- 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 mergeConfig
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function mergeConfig( array &$config, array $langConfig, $name, $prefix ) {
$analyzer = $langConfig[ 'analyzer' ][ $name ];
$config[ 'analyzer' ][ $prefix . '_' . $name ] = $analyzer;
if ( !empty( $analyzer[ 'filter' ] ) ) {
// Add private filters for this analyzer
- 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 monitorReindexTask
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function monitorReindexTask( ReindexTask $task, Index $target ) {
$consecutiveErrors = 0;
$sleepSeconds = self::monitorSleepSeconds( 1, 2, self::MONITOR_SLEEP_SECONDS );
$completionEstimateGen = self::estimateTimeRemaining();
while ( !$task->isComplete() ) {
- 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 transformElasticsearchResult
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformElasticsearchResult( ElasticaResultSet $result ) {
// Should we make this a concrete class?
return new class(
$this->titleHelper,
$this->fetchPhaseBuilder,
Method reindex
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reindex(
$slices = null,
$chunkSize = 100,
$acceptableCountDeviation = 0.05
) {
Method canRecycle
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function canRecycle() {
global $wgCirrusSearchRecycleCompletionSuggesterIndex;
if ( !$wgCirrusSearchRecycleCompletionSuggesterIndex ) {
return false;
}
Method buildTagWeightsFromLegacyParameters
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function buildTagWeightsFromLegacyParameters( $tagNames = null, $tagWeights = null ) {
Assert::parameterType(
[
'string',
'array',