Showing 1,238 of 1,238 total issues
Function afterDatasetsUpdate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
afterDatasetsUpdate: function(chart, options) {
var count = (chart.data.datasets || []).length;
var propagate = options.propagate;
var sources = [];
var meta, i, el, source;
Method applyFilter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function applyFilter( string $filter, bool $condition, ?int $value ): void {
$keys = $this->keys;
if ( $filter === 'fuzzy' ) {
$keys = $this->filterFuzzy( $keys, $condition );
} elseif ( $filter === 'hastranslation' ) {
Method tabify
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function tabify( Skin $skin, array &$tabs ): void {
$title = $skin->getTitle();
if ( !$title->isSpecialPage() ) {
return;
}
Method loadTranslationData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function loadTranslationData( IDatabase $db, MessageHandle $handle ): array {
$revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
$conditions = [];
// The list of pages we want to select, and their latest versions
Method getMessageParameters
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMessageParameters(): array {
$params = parent::getMessageParameters();
$type = $this->entry->getFullType();
Method getServersToUpdate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getServersToUpdate( ?string $requestedServiceId ): array {
$ttmServerFactory = Services::getInstance()->getTtmServerFactory();
if ( $requestedServiceId ) {
if ( !$ttmServerFactory->has( $requestedServiceId ) ) {
$this->logger->warning(
Method subGroups
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function subGroups(
AggregateMessageGroup $parent,
array &$childIds = [],
string $fname = 'caller'
): array {
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addDescription(
'Export a translatable bundle into a file that can then be imported ' .
'into another wiki using the importTranslatableBundle.php script'
Method inAllLanguages
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function inAllLanguages(): array {
$dbr = $this->loadBalancer->getConnection( DB_REPLICA, 'vslow' );
$res = $dbr->newSelectQueryBuilder()
->select( [
Method getContents
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getContents( $titles, int $namespace ): array {
$mwServices = MediaWikiServices::getInstance();
$dbr = $mwServices->getConnectionProvider()->getReplicaDatabase();
$revStore = $mwServices->getRevisionStore();
$titleContents = [];
Method execute
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $parameters ): void {
$this->setHeaders();
$this->addHelpLink( 'Help:Extension:Translate/Page translation administration' );
$out = $this->getOutput();
Similar blocks of code found in 2 locations. Consider refactoring. Open
var $toggleAllButton = $( '<span>' ).addClass( 'collapsed' )
.append(
'[',
$( '<a>' )
.attr( 'href', '#' )
- 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 57.
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
helpers$1.each(scalesOptions.yAxes, function(yAxisOptions, index) {
if (!yAxisOptions.id) {
yAxisOptions.id = nextAvailableScaleId(scalesOptions.yAxes, 'y-axis-', index);
}
});
- 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 57.
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 $toggler = $( '<span>' ).addClass( 'groupexpander collapsed' )
.append(
'[',
$( '<a>' )
.attr( 'href', '#' )
- 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 57.
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
helpers$1.each(scalesOptions.xAxes, function(xAxisOptions, index) {
if (!xAxisOptions.id) {
xAxisOptions.id = nextAvailableScaleId(scalesOptions.xAxes, 'x-axis-', index);
}
});
- 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 57.
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 addLanguageLinks
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function addLanguageLinks( Title $title, array &$languageLinks ) {
global $wgPageTranslationLanguageList;
if ( $wgPageTranslationLanguageList === 'tag-only' ) {
return;
- 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 parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function parse( string $text ): ParserOutput {
$nowiki = [];
$text = $this->armourNowiki( $nowiki, $text );
$sections = [];
- 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 getAuthors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getAuthors(): array {
$this->loadTranslations();
$authors = array_flip( $this->authors );
- 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 getPagesToMove
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getPagesToMove(
Title $source,
Title $target,
bool $moveSubPages,
bool $fetchTranslatableSubpages,
- 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 doCreate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function doCreate(): void {
$params = $this->extractRequestParams();
// Do validations
foreach ( explode( '|', 'username|password|email' ) as $field ) {
- 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"