Showing 1,238 of 1,238 total issues
Method addForm
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addForm(): void {
$formDescriptor = [
'select' => [
'type' => 'select',
'name' => self::GROUPS,
Method getSubpagesPerType
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSubpagesPerType( TranslatableBundle $bundle, bool $fetchTalkPages ): array {
$classifiedSubPages = $this->getEmptyResultSet();
$classifiedSubPages['translationPages'] = $bundle->getTranslationPages();
$classifiedSubPages['translationUnitPages'] = $bundle->getTranslationUnitPages();
Method getDefinitions
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDefinitions() {
global $wgTranslateSandboxLimit;
// This will contain the list of messages shown to the user
$list = [];
Function _resolveDataElementOptions
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
_resolveDataElementOptions: function(element, index) {
var me = this;
var custom = element && element.custom;
var cached = me._cachedDataOpts;
if (cached && !custom) {
Method handleRename
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleRename( string $target, string $replacement ): ?Title {
$newSourceTitle = null;
$sourceMessageHandle = new MessageHandle( $this->title );
$movableTitles = TranslateReplaceTitle::getTitlesForMove( $sourceMessageHandle, $replacement );
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ): void {
$out = $this->getOutput();
$lang = $this->getLanguage();
$this->progressStatsTable = $this->progressStatsTableFactory->newFromContext( $this->getContext() );
Method isValid
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isValid( &$reason ): bool {
$group = $this->group;
$pattern = $group->getSourceFilePath( '*' );
$filename = $group->getSourceFilePath( $this->languageCode );
Method importData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importData(
array $messagesWithTranslations,
Authority $authority,
string $comment,
?callable $progressReporter = null
Identical blocks of code found in 2 locations. Consider refactoring. Open
$( '<div>' )
.addClass( 'two columns tux-list-status text-center' )
.append(
$( '<span>' )
.addClass( statusClass )
- 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 71.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
$( '<div>' )
.addClass( 'two columns tux-list-status text-center' )
.append(
$( '<span>' )
.addClass( statusClass )
- 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 71.
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 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
$issues = new ValidationIssues();
$pluralRule = GettextPlural::getPluralRule( $targetLanguage );
// Skip validation for languages for which we do not know the plural rule
Similar blocks of code found in 2 locations. Consider refactoring. Open
var graphInfo = {
edits: mw.msg( 'translate-statsf-count-edits' ),
users: mw.msg( 'translate-statsf-count-users' ),
registrations: mw.msg( 'translate-statsf-count-registrations' ),
reviews: mw.msg( 'translate-statsf-count-reviews' ),
- 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 71.
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
}, granularityInfo = {
years: mw.msg( 'translate-statsf-scale-years' ),
months: mw.msg( 'translate-statsf-scale-months' ),
weeks: mw.msg( 'translate-statsf-scale-weeks' ),
days: mw.msg( 'translate-statsf-scale-days' ),
- 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 71.
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 computeLabelSizes
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function computeLabelSizes(ctx, tickFonts, ticks, caches) {
var length = ticks.length;
var widths = [];
var heights = [];
var offsets = [];
Method getAllowedParams
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getAllowedParams() {
return [
'title' => [
ParamValidator::PARAM_TYPE => 'string',
],
Function buildTicks
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildTicks: function() {
var me = this;
var min = me.min;
var max = me.max;
var options = me.options;
Method onDeleteTranslationUnit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function onDeleteTranslationUnit(
WikiPage $unit,
User $user,
$reason,
$id,
Method getAllowedParams
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getAllowedParams(): array {
return [
'group' => [
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true,
Method readFromVariable
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readFromVariable( string $data ): array {
$data = TextContent::normalizeLineEndings( $data );
$lines = array_map( 'ltrim', explode( "\n", $data ) );
$authors = $messages = [];
$lineContinuation = false;
Function left
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
left: function ( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
- 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"