Function getMessageParameters
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function getMessageParameters() {
if ( $this->parsedParametersDeleteLog !== null ) {
return $this->parsedParametersDeleteLog;
}
- 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 getActionLinks
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getActionLinks() {
$linkRenderer = $this->getLinkRenderer();
if ( !$this->context->getAuthority()->isAllowed( 'deletedhistory' )
|| $this->entry->isDeleted( LogPage::DELETED_ACTION )
) {
Function getParametersForApi
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function getParametersForApi() {
$entry = $this->entry;
$params = [];
$subtype = $this->entry->getSubtype();
- 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 getParametersForApi
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getParametersForApi() {
$entry = $this->entry;
$params = [];
$subtype = $this->entry->getSubtype();
Method getMessageParameters
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getMessageParameters() {
if ( $this->parsedParametersDeleteLog !== null ) {
return $this->parsedParametersDeleteLog;
}
Function getActionLinks
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getActionLinks() {
$linkRenderer = $this->getLinkRenderer();
if ( !$this->context->getAuthority()->isAllowed( 'deletedhistory' )
|| $this->entry->isDeleted( LogPage::DELETED_ACTION )
) {
- 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
Consider simplifying this complex logical expression. Open
if (
( $subtype === 'event' && count( $params ) === 6 )
|| (
$subtype === 'revision' && isset( $params[3] ) && count( $params ) === 7
&& in_array( $params[3], [ 'revision', 'archive', 'oldimage', 'filearchive' ] )
Avoid too many return
statements within this method. Open
return '';
Avoid too many return
statements within this method. Open
return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
Avoid too many return
statements within this method. Open
return '';
Function getMessageKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getMessageKey() {
$key = parent::getMessageKey();
if ( in_array( $this->entry->getSubtype(), [ 'event', 'revision' ] ) ) {
if ( count( $this->getMessageParameters() ) < 5 ) {
// Messages: logentry-delete-event-legacy, logentry-delete-revision-legacy,
- 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"