Showing 718 of 718 total issues
Function getIndex
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getIndex(): \Elastica\Index {
if ( $this->index ) {
return $this->index;
} else {
$indexBaseName = $this->indexBaseName;
- 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 getAliasedIndexName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getAliasedIndexName() {
// FIXME: Elastica seems to have trouble parsing the error reason
// for this endpoint. Running a simple HEAD first to check if it
// exists
$resp = $this->client->request( '_alias/' . self::INDEX_NAME, \Elastica\Request::HEAD, [] );
- 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 transformOneResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function transformOneResult( \Elastica\Result $result ) {
$source = $result->getSource();
if ( $source['namespace'] === NS_FILE ) {
if ( in_array( $source['title'], $this->fileTitles ) ) {
if ( $this->deduplicate ) {
- 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 getPrefixSearchRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getPrefixSearchRequest( $term, $variants ) {
$namespaces = $this->searchContext->getNamespaces();
if ( $namespaces === 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 build
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function build() {
$rescores = [];
foreach ( $this->profile['rescore'] as $rescoreDef ) {
$windowSize = $this->windowSize( $rescoreDef );
if ( $windowSize <= 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 buildFullTextSearch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function buildFullTextSearch( $term ) {
// Convert the unicode character 'ideographic whitespace' into standard
// whitespace. Cirrussearch treats them both as normal whitespace, but
// the preceding isn't appropriately trimmed.
// No searching for nothing! That takes forever!
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $namespaces, $weight, NamespaceInfo $namespaceInfo = null ) {
parent::__construct( $config, $weight );
$this->namespaceInfo = $namespaceInfo ?: MediaWikiServices::getInstance()->getNamespaceInfo();
$this->namespacesToBoost =
- 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 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"