Showing 691 of 718 total issues
Method apply
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply( SearchContext $context, $term ) {
$keyListRegex = implode(
'|',
array_map(
static function ( $kw ) {
CirrusSearch
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class CirrusSearch extends SearchEngine {
/**
* Special profile to instruct this class to use profile
* selection mechanism.
CirrusSearchResultBuilder
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class CirrusSearchResultBuilder {
/**
* @var array
*/
private $data;
ResultSet
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class ResultSet extends BaseSearchResultSet implements CirrusSearchResultSet {
use SearchResultSetTrait;
/**
* @var \Elastica\ResultSet
InterleavedResultSet
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class InterleavedResultSet extends BaseSearchResultSet implements CirrusSearchResultSet, SearchMetricsProvider {
use SearchResultSetTrait;
/** @var string[] Doc ID's belonging to team A */
private $teamA;
ArrayCirrusSearchResult
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class ArrayCirrusSearchResult extends CirrusSearchResult {
public const DOC_ID = 'doc_id';
public const SCORE = 'score';
public const EXPLANATION = 'explanation';
public const TEXT_SNIPPET = 'text_snippet';
Method buildSuggestConfig
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildSuggestConfig() {
$field = 'suggest';
$config = $this->query->getSearchConfig();
$suggestSettings = $this->getProfile();
$settings = [
Method indexData
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function indexData(): int {
// We build the suggestions by reading CONTENT and GENERAL indices.
// This does not support extra indices like FILES on commons.
$sourceIndexSuffixes = [ Connection::CONTENT_INDEX_SUFFIX, Connection::GENERAL_INDEX_SUFFIX ];
Function extractFullError
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function extractFullError( \Elastica\Exception\ExceptionInterface $exception ): array {
if ( $exception instanceof BulkResponseException ) {
$actionReasons = [];
foreach ( $exception->getActionExceptions() as $actionException ) {
$actionReasons[] = $actionException->getMessage() . ': '
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
public function build( SearchContext $searchContext, $term ) {
$searchContext->addSyntaxUsed( 'full_text' );
// Transform MediaWiki specific syntax to filters and extra
// (pre-escaped) query string
foreach ( $this->features as $feature ) {
- 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 compare
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def compare(q, docs_by_cluster, stats, index_type):
keys = list(docs_by_cluster.keys())
head = keys[0]
other = keys[1:]
if not other:
- 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 searchTextInternal
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function searchTextInternal( $term ) {
// Searcher needs to be cloned before any actual query building is done.
$interleaveSearcher = $this->buildInterleaveSearcher();
$qb = $this->buildFullTextSearch( $term );
Method execute
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$this->indexSuffix = $this->getBackCompatOption( 'indexSuffix', 'indexType' );
$this->indexBaseName = $this->getOption( 'baseName',
Method mergeStatusWithChildren
has 63 lines of code (exceeds 25 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'];
Method extractFullError
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function extractFullError( \Elastica\Exception\ExceptionInterface $exception ): array {
if ( $exception instanceof BulkResponseException ) {
$actionReasons = [];
foreach ( $exception->getActionExceptions() as $actionException ) {
$actionReasons[] = $actionException->getMessage() . ': '
Method extractMessageAndStatus
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function extractMessageAndStatus( \Elastica\Exception\ExceptionInterface $exception = null ) {
if ( !$exception ) {
return [ Status::newFatal( 'cirrussearch-backend-error' ), '' ];
}
File RequestLogger.php
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use ISearchResultSet;
SearchQueryBuilder
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
final class SearchQueryBuilder {
/**
* @var ParsedQuery
*/
BaseCirrusSearchResultSet
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class BaseCirrusSearchResultSet extends BaseSearchResultSet implements CirrusSearchResultSet {
use SearchResultSetTrait;
/** @var bool */
private $hasMoreResults = false;
File SuggestBuilder.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\BuildDocument\Completion;
use CirrusSearch\Connection;