Showing 994 of 1,238 total issues
File UpdateMessageJob.php
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Synchronization;
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;
Method doQuery
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doQuery( string $sourceLanguage, string $targetLanguage, string $text ): array {
if ( !$this->useWikimediaExtraPlugin() ) {
// ElasticTTM is currently not compatible with elasticsearch 2.x/5.x
// It needs FuzzyLikeThis ported via the wmf extra plugin
throw new RuntimeException( 'The wikimedia extra plugin is mandatory.' );
Method getGraphData
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGraphData( TranslationStatsGraphOptions $opts, Language $language ): array {
$dbr = $this->dbProvider->getReplicaDatabase();
$so = $this->getStatsProvider( $opts->getValue( 'count' ), $opts );
Function showTranslationMemory
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
showTranslationMemory: function ( translations ) {
if ( !translations.length ) {
return;
}
Function sendNotifications
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function sendNotifications( array $changesToProcess ): void {
if ( !$this->isEnabled() || $changesToProcess === [] ) {
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
File ActiveLanguagesSpecialPage.php
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Statistics;
MessageGroupOld
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class MessageGroupOld implements MessageGroup {
/**
* Human-readable name of this group
* @var string
*/
Function displayEmptyListHelp
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
displayEmptyListHelp: function () {
var messageTable = this,
// @todo Ugly! This should be provided somehow
selectedTab = $( '.tux-message-selector .selected' ).data( 'title' ),
$wrap = $( '<div>' ).addClass( 'tux-empty-list' ),
Function displayPagesToMove
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function displayPagesToMove( PageMoveCollection $pageCollection, bool $leaveRedirect ): void {
$infoMessage = "\nThe following pages will be moved:\n";
$count = 0;
$subpagesCount = 0;
$talkpagesCount = 0;
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$codes = MediaWikiServices::getInstance()
->getLanguageNameUtils()
->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::ALL );
- 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 createMessageGroup
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function createMessageGroup( string $id, array $info ): MessageGroup {
$conf = [];
$conf['BASIC']['class'] = MediaWikiExtensionMessageGroup::class;
$conf['BASIC']['id'] = $id;
$conf['BASIC']['namespace'] = $this->getNamespace();
- 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 identifySafeLanguages
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function identifySafeLanguages(
FileBasedMessageGroup $group,
MessageSourceChange $changesForGroup,
int $importStrategy
): array {
- 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 parseGettextSection
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function parseGettextSection( string $section, ?int $pluralCount ): ?array {
if ( trim( $section ) === '' ) {
return null;
}
- 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 showLanguages
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showLanguages() {
var ulslanguages = [],
selectedClasss = '',
quickLanguageList = [],
unique = [];
Method showAggregateGroup
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function showAggregateGroup( AggregateMessageGroup $group ): string {
$id = $group->getId();
$label = $group->getLabel();
$desc = $group->getDescription( $this->getContext() );
$sourceLanguage = $this->messageGroupMetadata->get( $id, 'sourcelanguagecode' );
File MessageIndex.php
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\MessageLoading;
Function load
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: function ( limit ) {
var self = this,
offset = this.$loader.data( 'offset' ),
pageSize = limit || this.$loader.data( 'pagesize' );
Method execute
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->checkUserRightsAny( 'pagetranslation' );
$params = $this->extractRequestParams();
$title = $this->getTitleFromTitleOrPageId( $params );
Method __construct
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addDescription( 'Export translations to files.' );
$this->addOption(