Showing 11,545 of 11,545 total issues
Function fetchFirstLetterData
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function fetchFirstLetterData() {
// Generate data from serialized data file
if ( isset( self::TAILORING_FIRST_LETTERS[$this->locale] ) ) {
$letters = require __DIR__ . "/data/first-letters-root.php";
// Append additional characters
- 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 moveInconsistentPage
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function moveInconsistentPage( $row, Title $title ) {
$titleImpossible = $title->getInterwiki() || !$title->canExist();
if ( $title->exists( IDBAccessObject::READ_LATEST ) || $titleImpossible ) {
if ( $titleImpossible ) {
$prior = $title->getPrefixedDBkey();
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( this.local ) {
ret.header = this.fullMonthNames[ dt.getMonth() + 1 ] + ' ' + dt.getFullYear();
d = dt.getDay() % 7;
e = this.getDaysInMonth( dt.getMonth() + 1, dt.getFullYear() );
} else {
- 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 100.
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
} else {
ret.header = this.fullMonthNames[ dt.getUTCMonth() + 1 ] + ' ' + dt.getUTCFullYear();
d = dt.getUTCDay() % 7;
e = this.getDaysInMonth( dt.getUTCMonth() + 1, dt.getUTCFullYear() );
}
- 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 100.
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
var suffixes = {
1: '-inci',
5: '-inci',
8: '-inci',
70: '-inci',
- 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 100.
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
var suffixes = {
1: "'inci",
5: "'inci",
8: "'inci",
70: "'inci",
- 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 100.
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 MessagesFr.php
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/** French (français)
*
* @file
* @ingroup Languages
File generateCollationData.php
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Maintenance script to generate first letter data files for Collation.php.
*
* This program is free software; you can redistribute it and/or modify
Function adjustComponent
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.widgets.datetime.ProlepticGregorianDateTimeFormatter.prototype.adjustComponent = function ( date, component, delta, mode ) {
let min, max;
if ( !( date instanceof Date ) ) {
date = this.defaultDate;
Function getFieldForTag
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.widgets.datetime.DateTimeFormatter.prototype.getFieldForTag = function ( tag, params ) {
let c, spec = null;
switch ( tag ) {
case 'intercalary':
Function WatchlistExpiryWidget
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WatchlistExpiryWidget( action, pageTitle, updateWatchLink, config ) {
let dataExpiryOptions = require( './data.json' ).options,
messageLabel,
dropdownLabel,
expiryDropdown,
Function buildHtml
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildHtml: function () {
let $container, $bits, panes, paneId, gitInfoText, $gitInfo;
$container = $( '<div>' )
.attr( {
Function processRelativeTime
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's':
return withoutSuffix || isFuture
Function relativeTimeMr
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function relativeTimeMr(number, withoutSuffix, string, isFuture) {
var output = '';
if (withoutSuffix) {
switch (string) {
case 's':
Function scrollIntoView
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
OO.ui.Element.static.scrollIntoView = function ( elOrPosition, config ) {
const deferred = $.Deferred();
// Configuration initialization
config = config || {};
Function _keydown
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
_keydown: function( event ) {
var match, prev, character, skip, regex,
preventDefault = true;
function escape( value ) {
Method getModuleRegistrations
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModuleRegistrations( Context $context ): string {
$resourceLoader = $context->getResourceLoader();
// Future developers: Use WebRequest::getRawVal() instead getVal().
// The getVal() method performs slow Language+UTF logic. (f303bb9360)
$safemode = $context->getRequest()->getRawVal( 'safemode' ) === '1';
Method beginAccountCreation
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function beginAccountCreation( Authority $creator, array $reqs, $returnToUrl ) {
$session = $this->request->getSession();
if ( !$this->canCreateAccounts() ) {
// Caller should have called canCreateAccounts()
$session->remove( self::ACCOUNT_CREATION_STATE );
Method writeSlot
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function writeSlot( SlotRecord $slot, $contentMode ) {
$isMain = $slot->getRole() === SlotRecord::MAIN;
$isV11 = $this->schemaVersion >= XML_DUMP_SCHEMA_VERSION_11;
if ( !$isV11 && !$isMain ) {
Method stream
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stream(
$headers = [], $sendErrors = true, $optHeaders = [], $flags = 0
) {
$headless = ( $flags & self::STREAM_HEADLESS );