File Reindexer.php
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\Maintenance;
use CirrusSearch\Connection;
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 reindex
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reindex(
$slices = null,
$chunkSize = 100,
$acceptableCountDeviation = 0.05
) {
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 makeRemoteReindexInfo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function makeRemoteReindexInfo( Connection $source, Connection $dest ) {
if ( $source->getClusterName() === $dest->getClusterName() ) {
return null;
}
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
SearchConfig $searchConfig,
Connection $source,
Connection $target,
Index $index,
Index $oldIndex,
Function reindex
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function reindex(
$slices = null,
$chunkSize = 100,
$acceptableCountDeviation = 0.05
) {
- 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 estimateTimeRemaining
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function estimateTimeRemaining(): \Generator {
$estimatedStr = null;
$remain = null;
$prevRemain = null;
$now = microtime( true );
- 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 waitForCounts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function waitForCounts( float $acceptableCountDeviation ) {
$oldCount = (float)$this->oldIndex->count();
$this->index->refresh();
// While elasticsearch should be ready immediately after a refresh, we have seen this return
// exceptionally low values in 2% of reindex attempts. Wait around a bit and hope the refresh
- 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 makeUpdateFieldsScript
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function makeUpdateFieldsScript() {
$script = [
'source' => '',
'lang' => 'painless',
];
- 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 makeRemoteReindexInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function makeRemoteReindexInfo( Connection $source, Connection $dest ) {
if ( $source->getClusterName() === $dest->getClusterName() ) {
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"