Showing 994 of 1,238 total issues
File ExportTranslationsMaintenanceScript.php
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Extension\Translate\Synchronization;
use FileBasedMessageGroup;
Function prepareInfoColumn
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareInfoColumn: function () {
var $infoColumn = $( '<div>' ).addClass( 'infocolumn' ),
translateEditor = this;
$infoColumn.append( $( '<div>' )
Method run
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function run( ApiPageSet $resultPageSet = null ): void {
$params = $this->extractRequestParams();
$group = MessageGroups::getGroup( $params['group'] );
if ( !$group ) {
Function parse
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function parse() {
$data = file_get_contents( $this->file );
$data = TextContent::normalizeLineEndings( $data );
$matches = [];
- 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
File GroupSynchronizationCache.php
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Synchronization;
MessageSourceChange
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class MessageSourceChange {
/**
* @var array[][][]
* @phpcs:ignore Generic.Files.LineLength
* @phan-var array<string,array<string,array<string|int,array{key:string,content:string,similarity?:float,matched_to?:string,previous_state?:string}>>>
File LanguageStatsSpecialPage.php
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Statistics;
Method languages
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function languages( $data, $params, $parser ) {
global $wgPageTranslationLanguageList;
if ( $wgPageTranslationLanguageList === 'sidebar-only' ) {
return '';
Function execute
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$handle = fopen( $this->getArg( 0 ), 'r' );
// remove heading
// @phan-suppress-next-line PhanPluginUseReturnValueInternalKnown
fgets( $handle );
- 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 onGetUserPermissionsErrorsExpensive
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public static function onGetUserPermissionsErrorsExpensive(
Title $title,
User $user,
$action,
&$result
- 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 execute
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$request = $this->getRequest();
$purge = $request->getVal( 'action' ) === 'purge';
if ( $purge && !$request->wasPosted() ) {
- 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 execute
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$config = $this->getConfig();
$logger = LoggerFactory::getInstance( 'Translate.GroupSynchronization' );
$groupPattern = $this->getOption( 'group' ) ?? '';
$logger->info(
- 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 displayRequestDetails
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayRequestDetails( request ) {
var $reminderStatus = $( '<span>' ).addClass( 'reminder-status' ),
$detailsPane = $( '.details.pane' );
if ( request.reminderscount ) {
var agoText = moment.isMoment( request.lastreminder ) ? moment( request.lastreminder ).fromNow() : request.lastreminder;
ElasticSearchTtmServer
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class ElasticSearchTtmServer
extends TtmServer
implements ReadableTtmServer, WritableTtmServer, SearchableTtmServer
{
/**
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 execute
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $parameters ) {
$this->setHeaders();
$user = $this->getUser();
$request = $this->getRequest();
- 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 execute
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): void {
$params = $this->extractRequestParams();
$filter = $params['filter'];
$groups = [];
- 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 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
$request = $this->getRequest();
$purge = $request->getVal( 'action' ) === 'purge';
if ( $purge && !$request->wasPosted() ) {
Function positionElement
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
function positionElement( $targetElem, options ) {
// Make a copy, we don't want to modify arguments
options = $.extend( {}, options );
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
Function listGroups
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
function listGroups( groupList, parentGrouppath, $parent, level ) {
var selectedClass = '',
maxListSize = 10,
currentGroup = $( '.facet.groups' ).data( 'group' ),
resultCount = groupList.length;