File updateCollation.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Find all rows in the categorylinks table whose collation is out-of-date
* (cl_collation != $wgCategoryCollation) and repopulate cl_sortkey
* using the page title and cl_sortkey_prefix.
Method execute
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->init();
$batchSize = $this->getBatchSize();
if ( $this->targetTable ) {
Function execute
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->init();
$batchSize = $this->getBatchSize();
if ( $this->targetTable ) {
- 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 showSortKeySizeHistogram
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showSortKeySizeHistogram() {
if ( !$this->sizeHistogram ) {
return;
}
$maxLength = max( array_keys( $this->sizeHistogram ) );
Function showSortKeySizeHistogram
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function showSortKeySizeHistogram() {
if ( !$this->sizeHistogram ) {
return;
}
$maxLength = max( array_keys( $this->sizeHistogram ) );
- 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 updateBatch
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateBatch( IResultWrapper $res ) {
if ( !$this->dryRun ) {
$this->beginTransaction( $this->dbw, __METHOD__ );
}
foreach ( $res as $row ) {
Function updateBatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function updateBatch( IResultWrapper $res ) {
if ( !$this->dryRun ) {
$this->beginTransaction( $this->dbw, __METHOD__ );
}
foreach ( $res as $row ) {
- 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 copyBatch
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function copyBatch( IResultWrapper $res ) {
$sortKeyInputs = [];
foreach ( $res as $row ) {
$title = Title::newFromRow( $row );
$sortKeyInputs[] = $title->getCategorySortkey( $row->cl_sortkey_prefix );
Method __construct
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addDescription( <<<TEXT
This script will find all rows in the categorylinks table whose collation is
Function copyBatch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function copyBatch( IResultWrapper $res ) {
$sortKeyInputs = [];
foreach ( $res as $row ) {
$title = Title::newFromRow( $row );
$sortKeyInputs[] = $title->getCategorySortkey( $row->cl_sortkey_prefix );
- 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"