Showing 691 of 718 total issues
Method validate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate() {
$this->outputIndented( "\tValidating shard allocation settings..." );
$actual = $this->fetchActualAllocation();
$changed = false;
Method execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
if ( $this->hasOption( 'nagios' ) ) {
// Force silent running mode so we can match Nagios expected output.
$this->mQuiet = true;
}
Method searchTextReal
has 32 lines of code (exceeds 25 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() ) {
Method nextToken
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function nextToken() {
Assert::precondition( $this->token->getStart() < $this->offset,
'You should not call nextToken() twice on the same offsets' );
$this->token->copyTo( $this->lookBehind );
$this->token->reset();
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function initialize( array $pagesOrRevs, int $flags ): array {
$documents = [];
$builders = $this->createBuilders( $flags );
foreach ( $pagesOrRevs as $pageOrRev ) {
if ( $pageOrRev instanceof RevisionRecord ) {
Method __construct
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addDescription( "Create a new suggester index. Always operates on a single cluster." );
$this->addOption( 'baseName', 'What basename to use for all indexes, ' .
'defaults to wiki id', false, true );
Method execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
// Use the default connection, rather than the one specified
// by --cluster, as we are collecting cluster independent metadata.
// Also our script specific `all` cluster fails self::getConnection.
$conn = Connection::getPool( $this->getSearchConfig() );
Method __construct
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addDescription( "Dump an index into a 'json' based format stdout. " .
"This format complies to the elasticsearch bulk format and can be directly used " .
"with a curl command like : " .
Function mergeStatusWithChildren
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function mergeStatusWithChildren( array $status, array $childResponse ) {
foreach ( $childResponse['nodes'] as $nodeData ) {
foreach ( $nodeData['tasks'] as $taskId => $childData ) {
$sliceId = $childData['status']['slice_id'];
$status['slices'][$sliceId] = $childData['status'];
- 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 reportUpdateMetrics
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function reportUpdateMetrics(
\Elastica\Bulk\ResponseSet $responseSet, $indexSuffix, $sent
) {
$updateStats = [
'sent' => $sent,
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$service = $this->service;
$verbose = $this->getParameter( 'verbose' );
$contexts = [];
foreach ( $service->listProfileTypes() as $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 sendBatch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function sendBatch() {
$allSame = true;
$firstRemediator = null;
foreach ( $this->perClusterBufferedRemediator as $remediator ) {
if ( $firstRemediator === 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 bestRoute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function bestRoute( SearchQuery $query ): SearchQueryRoute {
Assert::parameter( isset( $this->routes[$query->getSearchEngineEntryPoint()] ), 'query',
"Unsupported search engine entry point {$query->getSearchEngineEntryPoint()}" );
$routes = $this->routes[$query->getSearchEngineEntryPoint()];
- 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 getImplementation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getImplementation( $func ) {
$weight = $func['weight'] ?? 1;
$config = $this->context->getConfig();
switch ( $func['type'] ) {
case 'boostlinks':
- 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 getMapping
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getMapping( SearchEngine $engine ) {
if ( !( $engine instanceof CirrusSearch ) ) {
throw new \LogicException( "Cannot map CirrusSearch fields for another engine." );
}
$this->initFlags();
- 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 findUsedFromField
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function findUsedFromField( array $properties ) {
$analyzers = new Set();
foreach ( $properties as $name => $config ) {
foreach ( self::$ANALYZER_FIELDS as $key ) {
if ( isset( $config[$key] ) ) {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(
$langCode,
array $plugins,
SearchConfig $config = null,
CirrusSearchHookRunner $cirrusSearchHookRunner = 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function build( $self, array $options, $buildChunks, $fromPageId, $toPageId ) {
$fixedChunkSize = strpos( $buildChunks, 'total' ) === false;
$buildChunks = intval( $buildChunks );
if ( $fixedChunkSize ) {
$chunkSize = $buildChunks;
- 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 initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function initialize( array $pagesOrRevs, int $flags ): array {
$documents = [];
$builders = $this->createBuilders( $flags );
foreach ( $pagesOrRevs as $pageOrRev ) {
if ( $pageOrRev instanceof RevisionRecord ) {
- 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 find_candidates
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_candidates(start: datetime, end: datetime, batch_size: int = 10):
if end > start:
# works backwards, so the end time must come before the start time
start, end = end, start
- 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"