Showing 718 of 718 total issues
Function updateOtherIndex
has a Cognitive Complexity of 14 (exceeds 5 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;
}
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $requestedNamespaces, $localSearch, $withDefaultBoosts, $weight ) {
parent::__construct( $config, $weight );
// Use the boosted templates from extra indexes if available
$queries = [];
$weights = [];
- 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 run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function run(
SearcherFactory $factory,
CirrusSearchResultSet $initialResult,
MSearchResponses $responses,
NamespacePrefixParser $namespacePrefixParser,
- 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 checkConfig
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function checkConfig( $actual, array $required, $indent = null ) {
foreach ( $required as $key => $value ) {
$this->debugCheckConfig( "\n$indent$key: " );
if ( !array_key_exists( $key, $actual ) ) {
$this->debugCheckConfig( "not found..." );
- 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 validate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function validate(): Status {
// arrays of aliases to be added/removed
$add = $remove = [];
$this->outputIndented( "\tValidating $this->aliasName alias..." );
- 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 filterUnusedAnalysisChain
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function filterUnusedAnalysisChain( $analysis, Set $usedAnalyzers ) {
$sets = [
'analyzer' => $usedAnalyzers,
'filter' => new Set(),
'char_filter' => new Set(),
- 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 addRemoveEmpty
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function addRemoveEmpty( array $config ) {
foreach ( $config[ 'analyzer' ] as $name => $value ) {
if ( isset( $value[ 'type' ] ) && $value[ 'type' ] != 'custom' ) {
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 finalize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function finalize( Document $doc, bool $enforceLatest = true, RevisionRecord $revision = null ): bool {
$flags = CirrusIndexField::getHint( $doc, self::HINT_FLAGS );
if ( $flags !== null ) {
$docRevision = $doc->get( 'version' );
if ( $revision !== null && $docRevision !== $revision->getId() ) {
- 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 pickBest
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pickBest() {
if ( !$this->titles ) {
return null;
}
if ( !$this->term ) {
Method enableICUFolding
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function enableICUFolding( array $config, $language ) {
$unicodeSetFilter = $this->getICUSetFilter( $language );
$filter = [
'type' => 'icu_folding',
];
Method monitorReindexTask
has 43 lines of code (exceeds 25 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() ) {
Method onLinksUpdateComplete
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onLinksUpdateComplete( $linksUpdate, $ticket ) {
if ( !$this->isEnabled() ) {
return;
}
// defer processing the LinksUpdateComplete hook until other hooks tagged in PageChangeTracker
Method run
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run( Document $jobInfo, $numJobs, $minId, $maxId ) {
// @var int
$from = $jobInfo->get( 'sanitize_job_id_offset' );
$lastLoop = $jobInfo->get( 'sanitize_job_last_loop' );
// ternary is BC for when loop_id didn't exist.
Method replace
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function replace( array $profile, array $replacement ) {
$cur = &$profile;
foreach ( $replacement['matches'] as $match ) {
if ( !is_array( $cur ) ) {
return $profile;
Method doJob
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doJob() {
// While we can only have a single connection per job, we still
// use decideClusters() which includes a variety of safeguards.
$connections = $this->decideClusters( $this->params['update_group'] );
if ( !$connections ) {
Method getSupportedProfile
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSupportedProfile( $profileName ) {
$profile = $this->context->getConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::RESCORE, $profileName );
if ( !is_array( $profile ) ) {
Method fromSearchQuery
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromSearchQuery(
SearchQuery $query,
FallbackRunner $fallbackRunner = null,
CirrusSearchHookRunner $cirrusSearchHookRunner = null
): SearchContext {
Method run
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(
SearcherFactory $factory,
CirrusSearchResultSet $initialResult,
MSearchResponses $responses,
NamespacePrefixParser $namespacePrefixParser,
Method execute
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$profiles = [];
$profileService = $this->getSearchConfig()->getProfileService();
if ( $this->hasOption( 'profile' ) ) {
Method sendDeletes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendDeletes( $docIds, $indexSuffix = null ) {
if ( $indexSuffix === null ) {
$indexes = $this->connection->getAllIndexSuffixes( Connection::PAGE_DOC_TYPE );
} else {
$indexes = [ $indexSuffix ];