Showing 1,238 of 1,238 total issues
Function fit
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
fit: function() {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var display = opts.display;
Method rebuild
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rebuild( float $timestamp = null ): array {
static $recursion = 0;
if ( $recursion > 0 ) {
$msg = __METHOD__ . ': trying to recurse - building the index first time?';
Function addTranslate
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
addTranslate: function ( message ) {
var targetLangCode = this.$container.data( 'targetlangcode' ),
sourceLangCode = this.$container.data( 'sourcelangcode' ),
sourceLangDir = $.uls.data.getDir( sourceLangCode ),
status = message.properties.status,
PageTranslationSpecialPage
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class PageTranslationSpecialPage extends SpecialPage {
private const DISPLAY_STATUS_MAPPING = [
TranslatablePageStatus::PROPOSED => 'proposed',
TranslatablePageStatus::ACTIVE => 'active',
TranslatablePageStatus::OUTDATED => 'outdated',
Method displayPagesToMove
has 75 lines of code (exceeds 25 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;
ManageGroupsSpecialPage
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class ManageGroupsSpecialPage extends SpecialPage {
private const GROUP_SYNC_INFO_WRAPPER_CLASS = 'smg-group-sync-cache-info';
private const RIGHT = 'translate-manage';
protected DifferenceEngine $diff;
/** Name of the import. */
MessageGroupBase
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class MessageGroupBase implements MessageGroup {
/** @var array */
protected $conf;
/** @var int|false */
protected $namespace;
GettextFormat
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class GettextFormat extends SimpleFormat implements MetaYamlSchemaExtender {
private bool $allowPotMode = false;
private bool $offlineMode = false;
public function supportsFuzzy(): string {
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
$allChildRows.addClass( 'statstable-hide' );
$el.add( $allToggles ).addClass( 'collapsed' ).removeClass( 'expanded' );
$el.find( '> a' ).text( mw.msg( 'translate-langstats-expandall' ) );
$allToggles.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 95.
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' ) ) {
$allChildRows.removeClass( 'statstable-hide' );
$el.add( $allToggles ).removeClass( 'collapsed' ).addClass( 'expanded' );
$el.find( '> a' ).text( mw.msg( 'translate-langstats-collapseall' ) );
$allToggles.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 95.
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
$specialPageAliases['diq'] = [
'AggregateGroups' => [ 'GrubéAggregate' ],
'ImportTranslations' => [ 'AçarnayışaZerrefi' ],
'LanguageStats' => [ 'İstatistikêZıwani' ],
'ManageMessageGroups' => [ 'GrubanéMesacanİdareke' ],
- 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 141.
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
$specialPageAliases['fa'] = [
'AggregateGroups' => [ 'جمع_گروهها' ],
'ImportTranslations' => [ 'درونبری_ترجمهها' ],
'LanguageStats' => [ 'آمار_زبانها' ],
'ManageMessageGroups' => [ 'مدیریت_گروههای_پیغام' ],
- 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 141.
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
File DeleteTranslatableBundleSpecialPage.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
Method parseFile
has 74 lines of code (exceeds 25 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"
);
Function fit
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
fit: function() {
var me = this;
// Reset
var minSize = me.minSize = {
width: 0,
Method onActionMark
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function onActionMark( Title $title, ?int $revision ): void {
$request = $this->getRequest();
$out = $this->getOutput();
$translateTitle = $request->getCheck( 'translatetitle' );
Method __construct
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addArg(
'xml-path',
'Path to the XML file to be imported',
Function handleRenameSubmit
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function handleRenameSubmit(
MessageGroup $group,
MessageSourceChange $sourceChanges,
WebRequest $req,
string $language,
- 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 backport
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function backport(
FileBasedMessageGroup $group,
string $source,
string $targetPath,
array $keyCompatibilityMap,
- 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 formatGroup
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function formatGroup( $mixed, array $props, int $depth = 0 ): array {
$params = $this->extractRequestParams();
$context = $this->getContext();
// Default
- 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"