includes/specials/SpecialImport.php
Function doImport
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
Open
private function doImport() {
$isUpload = false;
$request = $this->getRequest();
$sourceName = $request->getVal( 'source' );
$assignKnownUsers = $request->getCheck( 'assignKnownUsers' );
- 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 showForm
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function showForm() {
$action = $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] );
$user = $this->getUser();
$out = $this->getOutput();
$this->addHelpLink( 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true );
File SpecialImport.php
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Implements Special:Import
*
* Copyright © 2003,2005 Brooke Vibber <bvibber@wikimedia.org>
Method doImport
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function doImport() {
$isUpload = false;
$request = $this->getRequest();
$sourceName = $request->getVal( 'source' );
$assignKnownUsers = $request->getCheck( 'assignKnownUsers' );
Function showForm
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
private function showForm() {
$action = $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] );
$user = $this->getUser();
$out = $this->getOutput();
$this->addHelpLink( 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true );
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( $par ) {
$this->useTransactionalTimeLimit();
$this->setHeaders();
$this->outputHeader();
Method getMappingFormPart
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getMappingFormPart( $sourceName ) {
$defaultNamespace = $this->getConfig()->get( MainConfigNames::ImportTargetNamespace );
return [
'mapping' => [
'type' => 'radio',