File ChangesList.php
has 622 lines of code (exceeds 250 allowed). Consider refactoring. 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
ChangesList
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class ChangesList extends ContextSource {
use ProtectedHookAccessorTrait;
public const CSS_CLASS_PREFIX = 'mw-changeslist-';
Method insertDiffHist
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
# Diff link
if (
$rc->mAttribs['rc_type'] == RC_NEW ||
$rc->mAttribs['rc_type'] == RC_LOG ||
Method showCharacterDifference
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
if ( !$context ) {
$context = RequestContext::getMain();
}
Method getArticleLink
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getArticleLink( &$rc, $unpatrolled, $watched ) {
$params = [];
if ( $rc->getTitle()->isRedirect() ) {
$params = [ 'redirect' => 'no' ];
}
Method insertUserRelatedLinks
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insertUserRelatedLinks( &$s, &$rc ) {
if ( static::isDeleted( $rc, RevisionRecord::DELETED_USER ) ) {
$deletedClass = 'history-deleted';
if ( static::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
$deletedClass .= ' mw-history-suppressed';
Method insertPageTools
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function insertPageTools( &$s, &$rc ) {
// FIXME Some page tools (e.g. thanks) might make sense for log entries.
if ( !in_array( $rc->mAttribs['rc_type'], [ RC_EDIT, RC_NEW ] )
// FIXME When would either of these not exist when type is RC_EDIT? Document.
|| !$rc->mAttribs['rc_this_oldid']
Function showCharacterDifference
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
if ( !$context ) {
$context = RequestContext::getMain();
}
- 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 revDateLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
RevisionRecord $rev,
Authority $performer,
Language $lang,
$title = null,
$className = ''
Function isUnpatrolled
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function isUnpatrolled( $rc, User $user ) {
if ( $rc instanceof RecentChange ) {
$isPatrolled = $rc->mAttribs['rc_patrolled'];
$rcType = $rc->mAttribs['rc_type'];
$rcLogType = $rc->mAttribs['rc_log_type'];
- 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 insertDiffHist
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
# Diff link
if (
$rc->mAttribs['rc_type'] == RC_NEW ||
$rc->mAttribs['rc_type'] == RC_LOG ||
- 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 insertComment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function insertComment( $rc ) {
if ( static::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
$deletedClass = 'history-deleted';
if ( static::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
$deletedClass .= ' mw-history-suppressed';
- 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 getArticleLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getArticleLink( &$rc, $unpatrolled, $watched ) {
$params = [];
if ( $rc->getTitle()->isRedirect() ) {
$params = [ 'redirect' => 'no' ];
}
- 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"