Showing 1,238 of 1,238 total issues
Method unflattenCLDRPlurals
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function unflattenCLDRPlurals( string $key, string $message ) {
// Quick escape.
if ( !str_contains( $message, '{{PLURAL' ) ) {
return false;
}
File ValidationRunner.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Message validation framework.
*
* @file
Function listen
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
listen: function () {
var groupSelector = this;
// Hide the selector panel when clicking outside of it
$( document.documentElement ).on( 'click', this.hide.bind( this ) );
Method run
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(): bool {
// WARNING: Nothing here must not depend on message index being up to date.
// For performance reasons, message index rebuild is run a separate job after
// everything else is updated.
Method fullTable
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fullTable(): string {
$modules = [];
Services::getInstance()->getHookRunner()->onTranslateBeforeAddModules( $modules );
$this->getOutput()->addModules( $modules );
Method factory
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function factory( string $serviceName, array $config ): ?TranslationWebService {
$handlers = [
'microsoft' => [
'class' => MicrosoftWebService::class,
'deps' => [ 'HttpRequestFactory' ]
Method makeList
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeList(): string {
$items = [];
$requests = [];
$users = $this->translateSandbox->getUsers();
Method execute
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$mwServices = MediaWikiServices::getInstance();
$config = $mwServices->getMainConfig();
if ( !$config->get( 'TranslateGroupSynchronizationCache' ) ) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else if (position === 'left') {
borderValue = alignBorderValue(me.right);
tx1 = me.right - tl;
tx2 = borderValue - axisHalfWidth;
x1 = alignBorderValue(chartArea.left) + axisHalfWidth;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method formatMessageBlock
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function formatMessageBlock(
string $key,
Message $message,
array $trans,
array $pot,
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (position === 'top') {
borderValue = alignBorderValue(me.bottom);
ty1 = me.bottom - tl;
ty2 = borderValue - axisHalfWidth;
y1 = alignBorderValue(chartArea.top) + axisHalfWidth;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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();
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
$children.addClass( 'statstable-hide' ).trigger( 'hide' );
doZebra( $table );
$el.addClass( 'collapsed' ).removeClass( 'expanded' );
$el.find( '> a' ).text( mw.msg( 'translate-langstats-expand' ) );
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( $el.hasClass( 'collapsed' ) ) {
$children.removeClass( 'statstable-hide' ).trigger( 'show' );
doZebra( $table );
$el.removeClass( 'collapsed' ).addClass( 'expanded' );
$el.find( '> a' ).text( mw.msg( 'translate-langstats-collapse' ) );
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 );