Showing 691 of 718 total issues
Function buildSuggestConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function buildSuggestConfig() {
$field = 'suggest';
$config = $this->query->getSearchConfig();
$suggestSettings = $this->getProfile();
$settings = [
- 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 enableICUTokenizer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function enableICUTokenizer( array $config ) {
foreach ( $config[ 'analyzer' ] as $name => &$value ) {
if ( isset( $value[ 'type' ] ) && $value[ 'type' ] != 'custom' ) {
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 reindex
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function reindex(
$slices = null,
$chunkSize = 100,
$acceptableCountDeviation = 0.05
) {
- 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 estimateTimeRemaining
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function estimateTimeRemaining(): \Generator {
$estimatedStr = null;
$remain = null;
$prevRemain = null;
$now = microtime( 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 standardTokenizerOnlyCleanup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function standardTokenizerOnlyCleanup( array $config ) {
foreach ( $config[ 'analyzer' ] as $name => &$value ) {
if ( isset( $value[ 'type' ] ) && $value[ 'type' ] != 'custom' ) {
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 collect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function collect( SearchSuggestion $suggestion, $profileName, $index ) {
if ( !$this->canCollect( $suggestion->getSuggestedTitleID(), $suggestion->getScore() ) ) {
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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate() {
$this->outputIndented( "Validating mappings..." );
if ( $this->optimizeIndexForExperimentalHighlighter &&
!in_array( 'experimental-highlighter', $this->availablePlugins ) ) {
$this->output( "impossible!\n" );
- 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 resolveFilters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function resolveFilters( array &$config, array $standardFilters, array $defaultFilters,
string $prefix ) {
$resultFilters = [];
foreach ( $config[ 'filter' ] as $name => $filter ) {
$existingFilter = $standardFilters[$name] ?? $defaultFilters[$name] ?? 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 waitForCounts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function waitForCounts( float $acceptableCountDeviation ) {
$oldCount = (float)$this->oldIndex->count();
$this->index->refresh();
// While elasticsearch should be ready immediately after a refresh, we have seen this return
// exceptionally low values in 2% of reindex attempts. Wait around a bit and hope the refresh
- 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 setupCopyTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function setupCopyTo( $config, $fields, $destination ) {
foreach ( $fields as $field => $weight ) {
// Note that weights this causes weights that are not whole numbers to be rounded up.
// We're ok with that because we don't have a choice.
for ( $r = 0; $r < $weight; $r++ ) {
- 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 fix
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function fix( $replacement ) {
Assert::precondition( $this->visited, "getFixablePart must be called before trying to fix the query" );
if ( $this->node === null ) {
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 getActualNamespaces
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getActualNamespaces( array $namespaces = null, array $additionalRequiredNamespaces = null ) {
if ( $this->requiredNamespaces === 'all' ) {
// e.g. prefix:all:foo (all namespaces must be queried no matter what is requested before
return [];
}
- 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 visitKeywordFeatureNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitKeywordFeatureNode( KeywordFeatureNode $node ) {
if ( !$this->negated() && ( $node->getKeyword() instanceof InTitleFeature ) && $node->getParsedValue() == [] ) {
// TODO: generalize this InTitleFeature behavior
// We want to keep the text of the intitle keyword on if:
// - it's not negated
- 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 overrideNumeric
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function overrideNumeric( &$dest, $request, $name, $limit = null, $upperLimit = true ) {
$val = $request->getVal( $name );
if ( $val !== null && is_numeric( $val ) ) {
if ( $limit === null ) {
$dest = $val;
- 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 nextToken
has a Cognitive Complexity of 7 (exceeds 5 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();
- 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 visitBooleanClause
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitBooleanClause( BooleanClause $clause ) {
if ( $clause->isExplicit() ) {
$this->isComplex = true;
}
$oldNegated = $this->inNegation;
- 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 classify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function classify( ParsedQuery $query ) {
$this->hasWords = false;
$this->hasSimplePhrase = false;
$this->hasComplex = false;
$this->depth = 0;
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
global $wgLanguageCode,
$wgCirrusSearchBannedPlugins,
$wgCirrusSearchMasterTimeout;
- 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_config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_config(parallelism: int) -> Sequence[ClusterToCheck]:
with ThreadPoolExecutor(max_workers=parallelism) as executor:
wiki_state = list(make_all_wiki_state(executor))
accept_all = [
- 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 wrapDecodeResults
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function wrapDecodeResults( BatchRowIterator $it, $endingAtColumn ) {
return new CallbackIterator( $it, function ( $batch ) use ( $endingAtColumn ) {
// Build the updater outside the loop because it stores the redirects it hits.
// Don't build it at the top level so those are stored when it is freed.
$updater = $this->createUpdater();
- 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"