File ManageGroupsSpecialPage.php
has 906 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Synchronization;
Function showChanges
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
protected function showChanges( int $limit ): void {
$diff = new DifferenceEngine( $this->getContext() );
$diff->showDiffStyle();
$diff->setReducedLineNumbers();
$this->diff = $diff;
- 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 formatChange
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatChange(
MessageGroup $group,
MessageSourceChange $changes,
string $language,
string $type,
Function formatChange
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function formatChange(
MessageGroup $group,
MessageSourceChange $changes,
string $language,
string $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
Method processSubmit
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processSubmit(): void {
$req = $this->getRequest();
$out = $this->getOutput();
$errorGroups = [];
Method showChanges
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function showChanges( int $limit ): void {
$diff = new DifferenceEngine( $this->getContext() );
$diff->showDiffStyle();
$diff->setReducedLineNumbers();
$this->diff = $diff;
Function processSubmit
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected function processSubmit(): void {
$req = $this->getRequest();
$out = $this->getOutput();
$errorGroups = [];
- 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
ManageGroupsSpecialPage
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class ManageGroupsSpecialPage extends SpecialPage {
private const GROUP_SYNC_INFO_WRAPPER_CLASS = 'smg-group-sync-cache-info';
private const RIGHT = 'translate-manage';
protected DifferenceEngine $diff;
/** Name of the import. */
Function handleRenameSubmit
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function handleRenameSubmit(
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
- 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 handleModificationsSubmit
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function handleModificationsSubmit(
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
- 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 handleRenameSubmit
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleRenameSubmit(
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
Method formatRename
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function formatRename(
MessageGroup $group,
array $addedMsg,
array $deletedMsg,
string $language,
Function showRenames
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function showRenames(
MessageGroup $group,
MessageSourceChange $sourceChanges,
OutputPage $out,
string $language,
- 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 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->setHeaders();
$out = $this->getOutput();
$out->addModuleStyles( 'ext.translate.specialpages.styles' );
Method startSync
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function startSync( array $modificationJobs, array $renameJobs ): void {
// We are adding an empty array for groups that have no jobs. This is mainly done to
// avoid adding unnecessary checks. Remove those using array_filter
$modificationGroupIds = array_keys( array_filter( $modificationJobs ) );
$renameGroupIds = array_keys( array_filter( $renameJobs ) );
Method showRenames
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showRenames(
MessageGroup $group,
MessageSourceChange $sourceChanges,
OutputPage $out,
string $language,
Method getRenameJobParams
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getRenameJobParams(
array $currentMsg,
MessageSourceChange $sourceChanges,
string $languageCode,
int $groupNamespace,
Method tabify
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function tabify( Skin $skin, array &$tabs ): void {
$title = $skin->getTitle();
if ( !$title->isSpecialPage() ) {
return;
}
Method handleModificationsSubmit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleModificationsSubmit(
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Language $contLang,
NamespaceInfo $nsInfo,
RevisionLookup $revLookup,
GroupSynchronizationCache $synchronizationCache,
JobQueueGroup $jobQueueGroup,
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->setHeaders();
$out = $this->getOutput();
$out->addModuleStyles( 'ext.translate.specialpages.styles' );
- 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 isRenameMissing
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
WebRequest $req,
MessageSourceChange $sourceChanges,
string $id,
string $key,
string $language,
Method handleRenameSubmit
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
array &$postponed,
Method handleModificationsSubmit
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
array &$postponed,
Method formatChange
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageGroup $group,
MessageSourceChange $changes,
string $language,
string $type,
array $params,
Method formatRename
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageGroup $group,
array $addedMsg,
array $deletedMsg,
string $language,
bool $isEqual,
Method getRenameJobParams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
array $currentMsg,
MessageSourceChange $sourceChanges,
string $languageCode,
int $groupNamespace,
string $selectedVal,
Consider simplifying this complex logical expression. Open
if ( $title && $type === 'addition' && $title->exists() ) {
// The message has for some reason dropped out from cache
// or, perhaps it is being reused. In any case treat it
// as a change for display, so the admin can see if
// action is needed and let the message be processed.
Method showRenames
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageGroup $group,
MessageSourceChange $sourceChanges,
OutputPage $out,
string $language,
int &$limit
Function formatRename
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function formatRename(
MessageGroup $group,
array $addedMsg,
array $deletedMsg,
string $language,
- 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 startSync
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function startSync( array $modificationJobs, array $renameJobs ): void {
// We are adding an empty array for groups that have no jobs. This is mainly done to
// avoid adding unnecessary checks. Remove those using array_filter
$modificationGroupIds = array_keys( array_filter( $modificationJobs ) );
$renameGroupIds = array_keys( array_filter( $renameJobs ) );
- 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 tabify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function tabify( Skin $skin, array &$tabs ): void {
$title = $skin->getTitle();
if ( !$title->isSpecialPage() ) {
return;
}
- 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"