Showing 718 of 718 total issues
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"
Further reading
Function parseValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function parseValue( $key, $value, $quotedValue, $valueDelimiter, $suffix, WarningCollector $warningCollector ) {
$matches = [];
$retValue = [];
// FIXME: we should probably no longer accept the empty string and simply return false
// instead of 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 setIfDefined
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function setIfDefined(
array $sourceArray,
$sourceKey,
array &$destArray,
$destKey = 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 buildSimpleAllFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildSimpleAllFilter( $options, $query ) {
$filter = new \Elastica\Query\BoolQuery();
$filter->setMinimumShouldMatch( 1 );
// FIXME: We can't use solely the stem field here
// - Depending on languages it may lack stopwords,
- 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 cleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function cleanup() {
$query = $this->rawQuery;
$nquery = Util::stripQuestionMarks( $query, $this->questionMarkStripLevel );
if ( $nquery !== $query ) {
$this->queryCleanups[ParsedQuery::CLEANUP_QMARK_STRIPPING] = 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 isEmpty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function isEmpty( $v ) {
return ( is_array( $v ) && count( $v ) === 0 ) ||
( is_object( $v ) && count( (array)$v ) === 0 ) ||
( is_string( $v ) && strlen( $v ) === 0 ) ||
( $v === 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 buildRegexWithPlugin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildRegexWithPlugin( $pattern, $insensitive ) {
$filters = [];
// TODO: Update plugin to accept multiple values for the field property
// so that at index time we can create a single trigram index with
// copy_to instead of creating multiple queries.
- 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 replacePartsOfQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function replacePartsOfQuery( $queryPart, $regex, $callable ) {
$destination = [];
$matches = [];
$offset = 0;
while ( preg_match( $regex, $queryPart, $matches, PREG_OFFSET_CAPTURE, $offset ) ) {
- 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 toArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function toArray() {
$ar = [
'query' => $this->query,
'rawQuery' => $this->rawQuery
];
- 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 searchFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function searchFor( $query ) {
$searchType = $this->getOption( 'type', 'full_text' );
if ( $searchType === 'archive' ) {
// Archive has its own engine so go directly there
- 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 decidePage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function decidePage( Updater $updater, WikiPage $page ) {
try {
$content = $page->getContent();
} catch ( Throwable $ex ) {
LoggerFactory::getInstance( 'CirrusSearch' )->warning(
- 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 processResultSet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function processResultSet( CirrusSearchResultSet $value, $query ) {
// these are prefix or full text results
$rows = [];
foreach ( $value as $result ) {
/** @var CirrusSearch\Search\CirrusSearchResult $result */
- 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"