includes/actions/HistoryAction.php
Method onView
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function onView() {
$out = $this->getOutput();
$request = $this->getRequest();
$config = $this->context->getConfig();
$services = MediaWikiServices::getInstance();
File HistoryAction.php
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Page history
*
* This program is free software; you can redistribute it and/or modify
Function onView
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
public function onView() {
$out = $this->getOutput();
$request = $this->getRequest();
$config = $this->context->getConfig();
$services = MediaWikiServices::getInstance();
- 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 feedItem
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function feedItem( $row, $formattedComment ) {
$revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
$rev = $revisionStore->newRevisionFromRow( $row, 0, $this->getTitle() );
$prevRev = $revisionStore->getPreviousRevision( $rev );
$revComment = $rev->getComment() === null ? null : $rev->getComment()->text;
Function getTimestampFromRequest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
private function getTimestampFromRequest( WebRequest $request ) {
// Backwards compatibility checks for URIs with only year and/or month.
$year = $request->getInt( 'year' );
$month = $request->getInt( 'month' );
$day = null;
- 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 feed
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function feed( $type ) {
if ( !FeedUtils::checkFeedOutput( $type, $this->getOutput() ) ) {
return;
}
$request = $this->getRequest();