maintenance/refreshLinks.php
File refreshLinks.php
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Function execute
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute() {
// Note that there is a difference between not specifying the start
// and end IDs and using the minimum and maximum values from the page
// table. In the latter case, deleteLinksFromNonexistent() will not
// delete entries for nonexistent IDs that fall outside the range.
- 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 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
// Note that there is a difference between not specifying the start
// and end IDs and using the minimum and maximum values from the page
// table. In the latter case, deleteLinksFromNonexistent() will not
// delete entries for nonexistent IDs that fall outside the range.
Method dfnCheckInterval
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function dfnCheckInterval( $start = null, $end = null, $batchSize = 100 ) {
$dbw = $this->getPrimaryDB();
$dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] );
$linksTables = [
Method doRefreshLinks
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function doRefreshLinks(
SelectQueryBuilder $builder,
bool $redirectsOnly = false,
array $indexFields = [ 'page_id' ]
) {
Function doRefreshLinks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
private function doRefreshLinks(
SelectQueryBuilder $builder,
bool $redirectsOnly = false,
array $indexFields = [ 'page_id' ]
) {
- 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 fixRedirect
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function fixRedirect( Maintenance $maint, $id ) {
$page = $maint->getServiceContainer()->getWikiPageFactory()->newFromID( $id );
// In case the page just got deleted.
if ( $page === null ) {