Showing 691 of 718 total issues
Function execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$utils = new ConfigUtils( $this->getConnection()->getClient(), $this );
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->metaStore = $this->getMetaStore();
if ( $this->hasOption( 'dump' ) ) {
$this->dump();
- 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 main
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def main(
allow_updates: bool,
page_id_exclusions_file: TextIO,
verbose: bool,
weighted_tags_queries: Sequence[str],
- 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 execute
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$service = $this->service;
$verbose = $this->getParameter( 'verbose' );
$contexts = [];
foreach ( $service->listProfileTypes() as $type ) {
Method getProfiles
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProfiles( $profileType, User $user = null ) {
$profileService = $this->config->getProfileService();
$serviceProfileType = null;
switch ( $profileType ) {
case SearchEngine::COMPLETION_PROFILE_TYPE:
Method buildConfig
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildConfig() {
$suggest = [
'dynamic' => false,
'_source' => [ 'enabled' => true ],
'properties' => [
Method validate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate() {
$this->outputIndented( "Validating mappings..." );
if ( $this->optimizeIndexForExperimentalHighlighter &&
!in_array( 'experimental-highlighter', $this->availablePlugins ) ) {
$this->output( "impossible!\n" );
Method buildGlobalCustomFilters
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function buildGlobalCustomFilters(): array {
$gcf = [
//////////////////////////
// char filters
'globo_norm' => new GlobalCustomFilter( 'char_filter' ),
Method finalize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function finalize( Document $doc, bool $enforceLatest = true, RevisionRecord $revision = null ): bool {
$flags = CirrusIndexField::getHint( $doc, self::HINT_FLAGS );
if ( $flags !== null ) {
$docRevision = $doc->get( 'version' );
if ( $revision !== null && $docRevision !== $revision->getId() ) {
Method extractDisplayTitle
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function extractDisplayTitle( Title $title, ParserOutput $output ): ?string {
$titleText = $title->getText();
$titlePrefixedText = $title->getPrefixedText();
$raw = $output->getDisplayTitle();
Method successApproximation
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function successApproximation( FallbackRunnerContext $context ) {
$firstPassResults = $context->getInitialResultSet();
if ( !$this->query->isAllowRewrite() ) {
return 0.0;
}
Method doTitleSnippet
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doTitleSnippet( Title $title, \Elastica\Result $result, array $highlights ) {
$matched = false;
foreach ( $this->highligtedFields[ArrayCirrusSearchResult::TITLE_SNIPPET] as $hlField ) {
if ( isset( $highlights[$hlField->getFieldName()] ) ) {
$nstext = $title->getNamespace() === 0 ? '' : $this->titleHelper->getNamespaceText( $title ) . ':';
Method copyQueryForCrossSearch
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function copyQueryForCrossSearch( SearchConfig $config, SearchQuery $original ): SearchQueryBuilder {
Assert::precondition( $original->getContextualFilters() === [], 'The initial must not have contextual filters' );
$builder = new self();
$builder->parsedQuery = $original->getParsedQuery();
$builder->searchEngineEntryPoint = $original->getSearchEngineEntryPoint();
Method isProfileNamespaceSupported
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function isProfileNamespaceSupported( array $profile ) {
if ( !is_array( $profile['supported_namespaces'] ) ) {
switch ( $profile['supported_namespaces'] ) {
case 'all':
return true;
Method pickIndexIdentifierFromOption
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pickIndexIdentifierFromOption( $option, $typeName ): Status {
if ( $option === 'now' ) {
$identifier = strval( time() );
$this->outputIndented( "Setting index identifier...{$typeName}_{$identifier}\n" );
return Status::newGood( $identifier );
Method fetchCategories
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fetchCategories( $rootCategory, WarningCollector $warningCollector ) {
$title = Title::makeTitleSafe( NS_CATEGORY, $rootCategory );
if ( $title === null ) {
$warningCollector->addWarning( 'cirrussearch-feature-deepcat-invalid-title' );
return [];
Method isIndexLive
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isIndexLive( $indexName ): Status {
try {
// primary check, verify no aliases point at our index. This invokes
// the endpoint directly, rather than Index::getAliases, as that method
// does not check http status codes and can incorrectly report no aliases.
Method collectTitlesFromDB
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function collectTitlesFromDB( $term ) {
$titles = [];
$found = [];
$titleFactory = MediaWikiServices::getInstance()->getTitleFactory();
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
Method finishInitializeBatch
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function finishInitializeBatch(): void {
if ( !$this->linkCountClosures ) {
return;
}
$linkCountClosureCount = count( $this->linkCountClosures );
Method identifyNamespace
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function identifyNamespace( $namespace, $method = 'naive', Language $language = null ) {
static $naive = null;
static $utr30 = null;
$normalizer = null;