Showing 994 of 1,238 total issues
Method formatMessageBlock
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function formatMessageBlock(
string $key,
Message $message,
array $trans,
array $pot,
Method getIssues
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
$issues = new ValidationIssues();
$definition = $message->definition();
$translation = $message->translation();
Function formatMessageGently
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
formatMessageGently: function ( text, key ) {
var protocols = mw.config.get( 'wgUrlProtocols' );
// Try to keep simple.
text = $( '<div>' ).text( text ).html();
Function drawBody
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawBody: function(pt, vm, ctx) {
var bodyFontSize = vm.bodyFontSize;
var bodySpacing = vm.bodySpacing;
var bodyAlign = vm._bodyAlign;
var body = vm.body;
Function showMessageDocumentation
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
showMessageDocumentation: function ( documentation ) {
if ( !mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
return;
}
Method getTextForRendering
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTextForRendering(
?Message $msg,
Language $sourceLanguage,
Language $targetLanguage,
bool $wrapUntranslated,
Function generateTicks
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateTicks(generationOptions, dataRange) {
var ticks = [];
// To get a "nice" value for the tick spacing, we will use the appropriately named
// "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
// for details.
Method execute
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
global $wgSitename, $wgTranslateMessageNamespaces;
$days = (int)$this->getOption( 'days', 30 );
$top = (int)$this->getOption( 'top', -1 );
Method replaceSubtitle
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function replaceSubtitle( &$subpages, ?Skin $skin, OutputPage $out ) {
$linker = MediaWikiServices::getInstance()->getLinkRenderer();
$isTranslationPage = TranslatablePage::isTranslationPage( $out->getTitle() );
if ( !$isTranslationPage
Function importHandler
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function importHandler( e ) {
var $errorBox = $( '.mw-tpm-sp-error__message' ),
$messageBox = $( '.mw-tpm-sp-instructions' );
e.preventDefault();
Method execute
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->addHelpLink( 'Help:Deletion_and_undeletion' );
$request = $this->getRequest();
Method parseQueryString
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseQueryString( string $queryString, array $opts ): array {
$fields = $highlights = [];
$terms = preg_split( '/\s+/', $queryString );
$match = $opts['match'];
$case = $opts['case'];
Method getData
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getData(): array {
// We need to get the primary group to get the correct file
// So $group can be different from $this->group
$group = $this->handle->getGroup();
if ( !$group instanceof FileBasedMessageGroup ) {
Method update
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update( MessageHandle $handle, ?string $targetText ): bool {
if ( !$handle->isValid() || $handle->getCode() === '' ) {
return false;
}
Method showLanguage
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showLanguage( string $code, array $users, int $cachedAt ): void {
$out = $this->getOutput();
$lang = $this->getLanguage();
// Information to be used inside the foreach loop.
Method execute
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$csvFilePath = $this->getArg( 0 );
$username = $this->getOption( 'user' );
$summary = $this->getOption( 'summary' );
Function exportGroup
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function exportGroup( MessageGroup $group, array $servers ): void {
$times = [
'total' => -microtime( true ),
'stats' => 0,
'init' => 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 15 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->checkUserRightsAny( 'pagetranslation' );
$params = $this->extractRequestParams();
$title = $this->getTitleFromTitleOrPageId( $params );
- 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 tryMatch
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function tryMatch( $code, $mws, $gtLanguages, $clLanguages ) {
if ( $mws !== '' ) {
$mwExp = true;
$lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $code );
} else {
- 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 onActionMark
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function onActionMark( Title $title, ?int $revision ): void {
$request = $this->getRequest();
$out = $this->getOutput();
$translateTitle = $request->getCheck( 'translatetitle' );
- 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"