Showing 718 of 718 total issues
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',
Method buildFromParsedQuery
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildFromParsedQuery( ParsedQuery $query ): AbstractQuery {
$visitor = new class( $query ) extends LeafVisitor {
public string $nearMatch;
public function __construct( ParsedQuery $query ) {
File SuggesterAnalysisConfigBuilder.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\Maintenance;
/**
Method detect
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function detect( $text ) {
$dirs = $this->config->getElement( 'CirrusSearchTextcatModel' );
if ( !$dirs ) {
return null;
}
Method updateOtherIndex
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateOtherIndex( $titles ) {
if ( !$this->connection->getConfig()->getElement( 'CirrusSearchWikimediaExtraPlugin', 'super_detect_noop' ) ) {
$this->logFailure( $titles, 'super_detect_noop plugin not enabled' );
return;
}
Method explain
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function explain( array $doc ) {
$qualityExplain = $this->intermediateExplain( $doc );
$pop = $doc['popularity_score'] ?? 0;
if ( $pop > self::POPULARITY_MAX ) {
$popExplain = [
Method customize
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function customize( array $config, $language ) {
$defaultStopSet = $this->getDefaultStopSet( $language );
$config['filter']['stop_filter']['stopwords'] = $defaultStopSet;
switch ( $this->getDefaultTextAnalyzerType( $language ) ) {
Function isProfileSyntaxSupported
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function isProfileSyntaxSupported( array $profile ) {
if ( ( $profile['supported_syntax'] ?? [] ) !== [] ) {
$supportedSyntax = false;
foreach ( $profile['supported_syntax'] as $supported ) {
if ( $this->context->isSyntaxUsed( $supported ) ) {
- 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 parseValue
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
$parsedValue = [];
$field = self::KEY_TABLE[$key];
$parsedValue['field'] = $field;
- 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 customize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function customize( array $config, $language ) {
$defaultStopSet = $this->getDefaultStopSet( $language );
$config['filter']['stop_filter']['stopwords'] = $defaultStopSet;
switch ( $this->getDefaultTextAnalyzerType( $language ) ) {
- 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"