Showing 718 of 718 total issues
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this function. Open
return 'Duplicate of live index ' + live_index + '. ' + reason
Function getExtraIndexesForNamespaces
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getExtraIndexesForNamespaces( SearchConfig $config, array $namespaces ) {
$extraIndexes = [];
foreach ( $config->get( 'CirrusSearchExtraIndexes' ) ?: [] as $namespace => $indexes ) {
if ( !in_array( $namespace, $namespaces ) ) {
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 hasProfile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function hasProfile( $type, $name ) {
if ( isset( $this->repositories[$type] ) ) {
foreach ( $this->repositories[$type] as $repo ) {
if ( $repo->hasProfile( $name ) ) {
return 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 loadInterwikiOverrides
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function loadInterwikiOverrides( SearchProfileService $service, SearchConfig $config ) {
if ( $config->isLocalWiki() || $config === $this->hostWikiConfig ) {
return;
}
$iwPrefix = $this->interwikiResolver->getInterwikiPrefix( $config->getWikiId() );
- 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 newHighlightField
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function newHighlightField(
$name,
$target,
$priority = HighlightedField::DEFAULT_TARGET_PRIORITY
): BaseHighlightedField {
- 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 suggest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function suggest( $text, $variants = null ) {
$suggestSearch = $this->getSuggestSearchRequest( $text, $variants );
$mSearchRequests = new MSearchRequests();
if ( $suggestSearch !== 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 getBoostForNamespace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getBoostForNamespace( $namespace ) {
if ( isset( $this->normalizedNamespaceWeights[$namespace] ) ) {
return $this->normalizedNamespaceWeights[$namespace];
}
if ( $this->namespaceInfo->isSubject( $namespace ) ) {
- 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 attachSearchRequests
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function attachSearchRequests( MSearchRequests $requests, Client $client ) {
$position = 0;
foreach ( $this->fallbackMethods as $method ) {
$position++;
if ( $method instanceof ElasticSearchRequestFallbackMethod ) {
- 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 buildRescoreQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function buildRescoreQuery() {
if ( !isset( $this->chain['functions'] ) ) {
throw new InvalidRescoreProfileException( "No functions defined in chain {$this->chainName}." );
}
foreach ( $this->chain['functions'] as $func ) {
- 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 buildMapping
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildMapping() {
$properties = [
'type' => [ 'type' => 'keyword' ],
'wiki' => [ 'type' => 'keyword' ],
];
- 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 unbalancedQuotes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function unbalancedQuotes( $text, $from = 0, $to = -1 ) {
$to = $to < 0 ? strlen( $text ) : $to;
$inQuote = false;
$inEscape = false;
for ( $i = $from; $i < $to; $i++ ) {
- 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 maybeSearchAndRewrite
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function maybeSearchAndRewrite(
FallbackRunnerContext $context,
SearchQuery $originalQuery,
string $suggestedQuery,
$suggestedQuerySnippet = 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 getPoolCounterType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getPoolCounterType(): string {
// Default pool counter for all search requests. Note that not all
// possible requests go through Searcher, so this isn't globally
// definitive.
$pool = 'CirrusSearch-Search';
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $weight, $profile ) {
parent::__construct( $config, $weight );
if ( isset( $profile['midpoint'] ) ) {
$this->midpoint = $this->getOverriddenFactor( $profile['midpoint'] );
- 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 handleSearchGetNearMatch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function handleSearchGetNearMatch( $term, &$titleResult ) {
global $wgSearchType;
if ( $wgSearchType !== 'CirrusSearch' ) {
return 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 switchFiltersToICUFoldingPreserve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function switchFiltersToICUFoldingPreserve( array $filters, $append = false ) {
if ( in_array( 'icu_folding', $filters ) ) {
// ICU folding already here
return $filters;
}
- 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 prefixSearchExtractNamespaceWithConnection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function prefixSearchExtractNamespaceWithConnection(
Connection $connection,
&$namespaces,
&$search
) {
- 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"