maintenance/SaneitizeJobs.php
File SaneitizeJobs.php
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace CirrusSearch\Maintenance;
use CirrusSearch\Connection;
Method showJobDetail
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function showJobDetail() {
$profile = $this->getSearchConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::SANEITIZER, $this->profileName );
'@phan-var array $profile';
Method pushJobs
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function pushJobs() {
$profile = $this->getSearchConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::SANEITIZER, $this->profileName );
'@phan-var array $profile';
Method initProfile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function initProfile() {
$res = $this->getDB( DB_REPLICA )
->newSelectQueryBuilder()
->select( [ 'min_id' => 'MIN(page_id)', 'max_id' => 'MAX(page_id)' ] )
->table( 'page' )
Function getJobInfo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private function getJobInfo( $jobName ) {
$latest = null;
// Fetch the lastest jobInfo from the metastore. Ideally all
// jobInfo should be the same but in the case a cluster has
// been decommissioned and re-added its job info may be outdated
- 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"