Showing 691 of 718 total issues
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"
Further reading
Function canCollect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function canCollect( $pageId, $score ) {
if ( in_array( $pageId, $this->bannedIds ) ) {
return false;
}
- 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 buildConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function buildConfig() {
global $wgCirrusSearchWeights;
$page = $this->getDefaultFields();
- 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 defaults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function defaults( $language ) {
// Use default lowercase filter
$lowercase_type = [ 'type' => 'lowercase' ];
if ( $this->isIcuAvailable() ) {
$lowercase_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 getBackCompatOption
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getBackCompatOption( string $current, string $bc, bool $required = true ) {
if ( $this->hasOption( $current ) && $this->hasOption( $bc ) ) {
$this->error( "\nERROR: --$current cannot be provided with --$bc" );
$this->maybeHelp( true );
} elseif ( $this->hasOption( $current ) ) {
- 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"
Further reading
Function extractTitleAndSimilarRedirects
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function extractTitleAndSimilarRedirects( array $doc ) {
$redirects = [];
if ( isset( $doc['redirect'] ) ) {
foreach ( $doc['redirect'] as $redir ) {
// Avoid suggesting/displaying non existent titles
- 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 stripQuestionMarks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function stripQuestionMarks( $term, $strippingLevel ) {
if ( strpos( $term, 'insource:/' ) === false &&
strpos( $term, 'intitle:/' ) === false &&
!preg_match( '/^[\p{P}\p{Z}]+$/u', $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"