includes/actions/McrUndoAction.php
File McrUndoAction.php
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Temporary action for MCR undos
* @file
* @ingroup Actions
Function onSubmit
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
public function onSubmit( $data ) {
if ( !$this->getRequest()->getCheck( 'wpSave' ) ) {
// Diff or preview
return false;
}
- 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 onSubmit
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function onSubmit( $data ) {
if ( !$this->getRequest()->getCheck( 'wpSave' ) ) {
// Diff or preview
return false;
}
Method getNewRevision
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getNewRevision() {
$undoRev = $this->revisionLookup->getRevisionById( $this->undo );
$oldRev = $this->revisionLookup->getRevisionById( $this->undoafter );
$curRev = $this->curRev;
Function getNewRevision
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
private function getNewRevision() {
$undoRev = $this->revisionLookup->getRevisionById( $this->undo );
$oldRev = $this->revisionLookup->getRevisionById( $this->undoafter );
$curRev = $this->curRev;
- 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 showPreview
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function showPreview( RevisionRecord $rev ) {
// Mostly copied from EditPage::getPreviewText()
$out = $this->getOutput();
try {
Method getFormFields
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getFormFields() {
$request = $this->getRequest();
$ret = [
'diff' => [
'type' => 'info',
Method show
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function show() {
// Send a cookie so anons get talk message notifications
// (copied from SubmitAction)
MediaWiki\Session\SessionManager::getGlobalSession()->persist();
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Article $article,
IContextSource $context,
ReadOnlyMode $readOnlyMode,
RevisionLookup $revisionLookup,
RevisionRenderer $revisionRenderer,
Avoid too many return
statements within this method. Open
Open
return Status::newGood();
Avoid too many return
statements within this method. Open
Open
return $updater->getStatus();