Showing 994 of 1,238 total issues
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. */
MessageGroupBase
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class MessageGroupBase implements MessageGroup {
/** @var array */
protected $conf;
/** @var int|false */
protected $namespace;
GettextFormat
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class GettextFormat extends SimpleFormat implements MetaYamlSchemaExtender {
private bool $allowPotMode = false;
private bool $offlineMode = false;
public function supportsFuzzy(): string {
File DeleteTranslatableBundleSpecialPage.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
Method parseFile
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseFile( string $csvFilePath ): Status {
if ( !file_exists( $csvFilePath ) || !is_file( $csvFilePath ) ) {
return Status::newFatal(
"CSV file path '$csvFilePath' does not exist, is not readable or is not a file"
);
Function fit
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
fit: function() {
var me = this;
// Reset
var minSize = me.minSize = {
width: 0,
Method onActionMark
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function onActionMark( Title $title, ?int $revision ): void {
$request = $this->getRequest();
$out = $this->getOutput();
$translateTitle = $request->getCheck( 'translatetitle' );
Method __construct
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addArg(
'xml-path',
'Path to the XML file to be imported',
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 backport
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function backport(
FileBasedMessageGroup $group,
string $source,
string $targetPath,
array $keyCompatibilityMap,
- 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 formatGroup
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function formatGroup( $mixed, array $props, int $depth = 0 ): array {
$params = $this->extractRequestParams();
$context = $this->getContext();
// Default
- 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 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->bundleMover = Services::getInstance()->getTranslatableBundleMover();
$mwService = MediaWikiServices::getInstance();
$this->titleParser = $mwService->getTitleParser();
Method onSaveComplete
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function onSaveComplete(
WikiPage $wikiPage,
UserIdentity $userIdentity,
string $summary,
int $flags,
Method execute
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
$title = Title::newFromText( $params['title'] );
if ( !$title ) {
Function addMessage
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addMessage( message ) {
var $messageTable = $( '.tux-messagelist' ),
sourceLanguage = $messageTable.data( 'sourcelangcode' ),
sourceLanguageDir = $.uls.data.getDir( sourceLanguage ),
targetLanguage = $messageTable.data( 'targetlangcode' ),
Function addExpanders
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addExpanders( $table ) {
var $metaRows = $( 'tr.AggregateMessageGroup', $table );
// Quick return
if ( !$metaRows.length ) {
Method actionLinks
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function actionLinks( array $page, string $type ): string {
// Performance optimization to avoid calling $this->msg in a loop
static $messageCache = null;
if ( $messageCache === null ) {
$messageCache = [
Method getPageMoveCollection
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPageMoveCollection(
Title $source,
?Title $target,
User $user,
string $reason,
Method parseFile
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseFile(): array {
$defines = file_get_contents( $this->definitionFile );
$linefeed = '(\r\n|\n)';
$sections = array_map(
'trim',
Method sendNotifications
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendNotifications( array $changesToProcess ): void {
if ( !$this->isEnabled() || $changesToProcess === [] ) {
return;
}