Showing 718 of 718 total issues
Function configureHighlighting
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function configureHighlighting( array &$field, array $subFields, $rootField = true ) {
if ( $this->mappingFlags & MappingConfigBuilder::OPTIMIZE_FOR_EXPERIMENTAL_HIGHLIGHTER ) {
if ( $this->checkFlag( self::SPEED_UP_HIGHLIGHTING ) ) {
if ( $rootField ) {
$field[ 'index_options' ] = 'offsets';
- 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 overrideMoreLikeThisOptionsFromMessage
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static function overrideMoreLikeThisOptionsFromMessage() {
global $wgCirrusSearchMoreLikeThisConfig,
$wgCirrusSearchMoreLikeThisAllowedFields,
$wgCirrusSearchMoreLikeThisMaxQueryTermsLimit,
$wgCirrusSearchMoreLikeThisFields;
- 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 pickBest
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function pickBest() {
if ( !$this->titles ) {
return null;
}
if ( !$this->term ) {
- 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 getMapping
has 72 lines of code (exceeds 25 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();
Method classifyError
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function classifyError( \Elastica\Exception\ExceptionInterface $exception = null ) {
if ( $exception === null ) {
return 'unknown';
}
$error = self::extractFullError( $exception );
SearchProfileService
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class SearchProfileService {
/**
* Profile type for ordering crossproject result blocks
*/
Method showJobDetail
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showJobDetail() {
$profile = $this->getSearchConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::SANEITIZER, $this->profileName );
'@phan-var array $profile';
Function parse
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $query, $start, $end ) {
$match = [];
Assert::precondition( $start < $end, '$start < $end' );
Assert::precondition( $end <= strlen( $query ), '$end <= strlen( $query )' );
if ( preg_match( self::PHRASE_REGEX, $query, $match, 0, $start ) === 1 ) {
- 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 reformat
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function reformat( array $problems ): array {
$clean = [];
$indexBaseName = $this->getSearchConfig()->get( SearchConfig::INDEX_BASE_NAME );
// Generic connection for resolving index names, its always the same everywhere
$connection = Connection::getPool( $this->getSearchConfig() );
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"