Showing 691 of 718 total issues
File AnalyzerBuilder.php
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\Maintenance;
use MediaWiki\Config\ConfigException;
QueryStringRegexParser
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class QueryStringRegexParser implements QueryParser {
/**
* Whitespace regex including unicode and some control chars
*/
private const WHITESPACE_REGEX = '/\G[\pZ\pC]+/u';
Function detect
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function detect( $text ) {
$dirs = $this->config->getElement( 'CirrusSearchTextcatModel' );
if ( !$dirs ) {
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 doJob
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected function doJob() {
$profile = $this->searchConfig
->getProfileService()
->loadProfileByName( SearchProfileService::SANEITIZER, $this->params['profile'], 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 parse
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function parse( string $query, int $start, int $end ) {
$match = [];
Assert::precondition( $start < $end, '$start < $end' );
Assert::precondition( $end <= strlen( $query ), '$end <= strlen( $query )' );
$ret = preg_match( self::NEGATION, $query, $match, PREG_OFFSET_CAPTURE, $start );
- 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 truncateField
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private function truncateField( string $field, bool $keyword, int $minFieldLength, int $maxDocSize, string $statBucket ): void {
if ( !$this->document->has( $field ) ) {
return;
}
$fieldData = $this->document->get( $field );
- 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
AnalysisConfigBuilder
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class AnalysisConfigBuilder {
/**
* Version number for the core analysis. Increment the major
* version when the analysis changes in an incompatible way,
* and change the minor version when it changes but isn't
UpdateSuggesterIndex
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class UpdateSuggesterIndex extends Maintenance {
/**
* @var string language code we're building for
*/
private $langCode;
Method execute
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$utils = new ConfigUtils( $this->getConnection()->getClient(), $this );
Function bulkResponseExceptionIsJustDocumentMissing
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function bulkResponseExceptionIsJustDocumentMissing(
ResponseException $exception, $logCallback = null
) {
$justDocumentMissing = true;
foreach ( $exception->getResponseSet()->getBulkResponses() as $bulkResponse ) {
- 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 searchTextInternal
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function searchTextInternal( $term ) {
// Searcher needs to be cloned before any actual query building is done.
$interleaveSearcher = $this->buildInterleaveSearcher();
$qb = $this->buildFullTextSearch( $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 configureHighlighting
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function configureHighlighting( array &$field, array $subFields, $rootField = true ) {
if ( $this->mappingFlags & MappingConfigBuilder::OPTIMIZE_FOR_EXPERIMENTAL_HIGHLIGHTER ) {
if ( $this->checkFlag( self::SPEED_UP_HIGHLIGHTING ) ) {
if ( $rootField ) {
$field[ 'index_options' ] = 'offsets';
- 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 overrideMoreLikeThisOptionsFromMessage
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static function overrideMoreLikeThisOptionsFromMessage() {
global $wgCirrusSearchMoreLikeThisConfig,
$wgCirrusSearchMoreLikeThisAllowedFields,
$wgCirrusSearchMoreLikeThisMaxQueryTermsLimit,
$wgCirrusSearchMoreLikeThisFields;
- 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 pickBest
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function pickBest() {
if ( !$this->titles ) {
return null;
}
if ( !$this->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
Method getMapping
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMapping( SearchEngine $engine ) {
if ( !( $engine instanceof CirrusSearch ) ) {
throw new \LogicException( "Cannot map CirrusSearch fields for another engine." );
}
$this->initFlags();
Method classifyError
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function classifyError( \Elastica\Exception\ExceptionInterface $exception = null ) {
if ( $exception === null ) {
return 'unknown';
}
$error = self::extractFullError( $exception );
SearchProfileService
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class SearchProfileService {
/**
* Profile type for ordering crossproject result blocks
*/
Method showJobDetail
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showJobDetail() {
$profile = $this->getSearchConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::SANEITIZER, $this->profileName );
'@phan-var array $profile';
Function parse
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $query, $start, $end ) {
$match = [];
Assert::precondition( $start < $end, '$start < $end' );
Assert::precondition( $end <= strlen( $query ), '$end <= strlen( $query )' );
if ( preg_match( self::PHRASE_REGEX, $query, $match, 0, $start ) === 1 ) {
- 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 reformat
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function reformat( array $problems ): array {
$clean = [];
$indexBaseName = $this->getSearchConfig()->get( SearchConfig::INDEX_BASE_NAME );
// Generic connection for resolving index names, its always the same everywhere
$connection = Connection::getPool( $this->getSearchConfig() );