Showing 994 of 1,238 total issues
File ElasticSearchTtmServer.php
has 519 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\TtmServer;
File SearchTranslationsSpecialPage.php
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\TtmServer;
File GettextFormat.php
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\FileFormatSupport;
File groupStatistics.php
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Commandline script to general statistics about the localisation level of
* one or more message groups.
*
File ext.translate.special.translate.js
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
( function () {
'use strict';
var state, hideOptionalMessages = '!optional';
Method execute
has 199 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $subPage ) {
$this->setHeaders();
$this->checkPermissions();
$server = $this->ttmServerFactory->getDefaultForQuerying();
Method showPage
has 186 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showPage( TranslatablePageMarkOperation $operation ): void {
$page = $operation->getPage();
$out = $this->getOutput();
$out->addWikiMsg( 'tpt-showpage-intro' );
Method execute
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute(): void {
$this->checkUserRightsAny( self::$right );
$block = $this->getUser()->getBlock();
if ( $block && $block->isSitewide() ) {
$this->dieBlocked( $block );
File ServiceWiring.php
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* List of services in this extension with construction instructions.
*
* @file
Method execute
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$logger = LoggerFactory::getInstance( 'Translate.GroupSynchronization' );
$groupPattern = $this->getOption( 'group' ) ?? '';
$groupSkipPattern = $this->getOption( 'skipgroup' ) ?? '';
$skipGroupSyncCheck = $this->hasOption( 'skip-group-sync-check' );
Services
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
class Services implements ContainerInterface {
private ContainerInterface $container;
private function __construct( ContainerInterface $container ) {
$this->container = $container;
File MessageGroupStats.php
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Statistics;
Function handleFuzzy
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
private function handleFuzzy( Title $title, bool $invalidate, PageUpdater $updater, int $baseTranver ): void {
global $wgTranslateDocumentationLanguageCode;
$editResult = $updater->getEditResult();
if ( !$invalidate && !$editResult->isExactRevert() ) {
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
MessageCollection
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
class MessageCollection implements ArrayAccess, Iterator, Countable {
/**
* The queries can get very large because each message title is specified
* individually. Very large queries can confuse the database query planner.
* Queries are split into multiple separate queries having at most this many
Method execute
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( array $messages ): bool {
$context = RequestContext::getMain();
$output = $context->getOutput();
// Set up diff engine
File index.js
has 414 lines of code (exceeds 250 allowed). Consider refactoring. Open
( function () {
'use strict';
var groupsLoader, delay;
Function parseFile
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
protected function parseFile(): array {
$defines = file_get_contents( $this->definitionFile );
$linefeed = '(\r\n|\n)';
$sections = array_map(
'trim',
- 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 MessageGroups.php
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\MessageGroupProcessing;
File TranslatablePageMarker.php
has 408 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
Function run
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
private function run( ApiPageSet $resultPageSet = null ): void {
$params = $this->extractRequestParams();
$group = MessageGroups::getGroup( $params['group'] );
if ( !$group ) {
- 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"