Showing 994 of 1,238 total issues
File MessageWebImporter.php
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Synchronization;
File TranslatablePage.php
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
File MoveTranslatableBundleSpecialPage.php
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
Hooks
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class Hooks {
private const PAGEPROP_HAS_LANGUAGES_TAG = 'translate-has-languages-tag';
/** @var bool Uuugly hacks */
public static $allowTargetEdit = false;
/** State flag used by DeleteTranslatableBundleJob for performance optimizations. */
Method onChangesListSpecialPageStructuredFilters
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onChangesListSpecialPageStructuredFilters( $special ): void {
$translateRcFilterDefault = $this->config->get( 'TranslateRcFilterDefault' );
$defaultFilter = $translateRcFilterDefault !== 'noaction' ?
$translateRcFilterDefault :
ChangesListStringOptionsFilterGroup::NONE;
Function execute
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $subPage ) {
$this->setHeaders();
$this->checkPermissions();
$server = $this->ttmServerFactory->getDefaultForQuerying();
- 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 initMessages
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function initMessages(): void {
if ( $this->messages !== null ) {
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"
Further reading
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
File ext.translate.special.pagemigration.js
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
( function () {
'use strict';
var noOfSourceUnits, noOfTranslationUnits,
pageName = '',
langCode = '',
Function draw
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function() {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var globalDefaults = core_defaults.global;
Function addMessageUpdateChanges
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function addMessageUpdateChanges(
FileBasedMessageGroup $group,
string $language,
MessageSourceChange $changes,
int $reason,
- 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 ext.translate.special.aggregategroups.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
( function () {
'use strict';
function getApiParams( $target ) {
return {
Function assign
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
function assign( ta ) {
if ( !ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has( ta ) ) { return; }
var heightOffset = null,
clientWidth = null,
TranslatablePage
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class TranslatablePage extends TranslatableBundle {
/**
* List of keys in the metadata table that need to be handled for moves and deletions
* @phpcs-require-sorted-array
*/
Method showConfirmation
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function showConfirmation( PageMoveCollection $pageCollection, TranslatableBundle $bundle ): void {
$out = $this->getOutput();
$out->addBacklinkSubtitle( $this->oldTitle );
$out->addWikiMsg(
'pt-movepage-intro',
Function parseFile
has a Cognitive Complexity of 31 (exceeds 5 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"
);
- 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 getGraphData
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function getGraphData( TranslationStatsGraphOptions $opts, Language $language ): array {
$dbr = $this->dbProvider->getReplicaDatabase();
$so = $this->getStatsProvider( $opts->getValue( 'count' ), $opts );
- 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 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $parameters ) {
$this->setHeaders();
$user = $this->getUser();
$request = $this->getRequest();
File TranslateSpecialPage.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\TranslatorInterface;
GroupSynchronizationCache
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class GroupSynchronizationCache {
private PersistentCache $cache;
private int $initialTimeoutSeconds;
private int $incrementalTimeoutSeconds;
/** @var string Cache tag used for groups */