Showing 718 of 718 total issues
Function run
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def run(wiki, clusters, index_types, batch_size, start, end, q, stats):
Function addRequest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addRequest( RequestLog $log, UserIdentity $user = null, $slowMillis = null ) {
global $wgCirrusSearchLogElasticRequests;
// @todo Is this necessary here? Check on what uses the response value
$finalContext = $log->getLogVariables() + [
- 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 classifyError
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function classifyError( \Elastica\Exception\ExceptionInterface $exception = null ) {
if ( $exception === null ) {
return 'unknown';
}
$error = self::extractFullError( $exception );
- 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 getStatus
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getStatus() {
if ( $this->response ) {
// task complete
return $this->response;
}
- 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 createFromProfile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function createFromProfile( SearchQuery $query, array $profile, InterwikiResolver $interwikiResolver ): FallbackRunner {
$fallbackMethods = [];
$methodDefs = $profile['methods'] ?? [];
foreach ( $methodDefs as $name => $methodDef ) {
if ( !isset( $methodDef['class'] ) ) {
- 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 canMerge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function canMerge( BaseHighlightedField $other ) {
if ( $this->highlighterType !== $other->highlighterType ) {
return false;
}
if ( $this->getTarget() !== $other->getTarget() ) {
- 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 prepareQueryParams
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function prepareQueryParams( array $settings ) {
$def = [];
foreach ( self::$rescoreMainParams as $param ) {
if ( !isset( $settings[$param] ) ) {
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 findRedirectTitle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function findRedirectTitle( \Elastica\Result $result, $snippet ) {
$title = $this->stripHighlighting( $snippet );
// Grab the redirect that matches the highlighted title with the lowest namespace.
$redirects = $result->redirect;
// That is pretty arbitrary but it prioritizes 0 over others.
- 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 merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function merge( HighlightedField $other ): HighlightedField {
if ( $this->getFieldName() !== $other->getFieldName() ) {
throw new \InvalidArgumentException(
"Rejecting nonsense merge: Refusing to merge two HighlightFields with different field names: " .
"[{$other->getFieldName()}] != [{$this->getFieldName()}]" );
- 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 doMainSnippet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function doMainSnippet( $highlights ) {
$hasTextSnippet = false;
foreach ( $this->highligtedFields[ArrayCirrusSearchResult::TEXT_SNIPPET] as $hlField ) {
if ( isset( $highlights[$hlField->getFieldName()][0] ) ) {
$snippet = $highlights[$hlField->getFieldName()][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 getDefaultFilters
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getDefaultFilters( array &$config, array $analyzers ) {
$defaultFilters = [];
foreach ( $analyzers as $analyzer ) {
if ( empty( $config[ 'analyzer' ][ $analyzer ][ 'filter' ] ) ) {
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 handleVariants
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function handleVariants( Suggest $suggests, array $variants, $queryLen, $term ) {
$variantIndex = 0;
$done = [ $term ];
foreach ( $variants as $variant ) {
if ( in_array( $variant, $done, 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 parseValue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
$values = explode( '|', $value, self::MAX_CONDITIONS + 1 );
if ( count( $values ) > self::MAX_CONDITIONS ) {
$warningCollector->addWarning(
'cirrussearch-feature-too-many-conditions',
- 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 getValueRegex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getValueRegex() {
Assert::invariant( $this->hasValue(), __METHOD__ . ' called but hasValue() is false' );
if ( $this->greedy() ) {
Assert::precondition( !$this->allowEmptyValue(), "greedy keywords must not accept empty value" );
// XXX: we ignore value delimiter for greedy keywords
- 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 getValueRegex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getValueRegex( KeywordFeature $feature ) {
Assert::invariant( $feature->hasValue(), __METHOD__ . ' called but hasValue() is false' );
if ( $feature->greedy() ) {
// XXX: we send raw value to the keyword
return '(?<unquoted>.+)';
- 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 parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function parse( string $query ): ParsedQuery {
$this->reInit( $query );
$queryLen = mb_strlen( $query );
if ( $queryLen > self::QUERY_LEN_HARD_LIMIT ) {
throw new SearchQueryParseException( 'cirrussearch-query-too-long',
- 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 checkQueryLen
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function checkQueryLen(): void {
Assert::precondition( $this->query !== null, "Query must be set" );
$maxLen = $this->maxQueryLen;
$exemptKeywords = [];
foreach ( $this->preTaggedNodes as $node ) {
- 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 boostTemplates
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function boostTemplates( array $doc, $score ) {
if ( !isset( $doc['template'] ) ) {
return $score;
}
- 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 canRecycle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function canRecycle() {
global $wgCirrusSearchRecycleCompletionSuggesterIndex;
if ( !$wgCirrusSearchRecycleCompletionSuggesterIndex ) {
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
Method onPageDeleteComplete
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
ProperPageIdentity $page,
Authority $deleter,
string $reason,
int $pageID,
RevisionRecord $deletedRev,