Showing 11,545 of 11,545 total issues
Function animateFilterAndLang
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
private function animateFilterAndLang( $name ) {
$this->debug( "animate filter for tag $name" );
if ( $this->reader->nodeType !== XMLReader::ELEMENT ) {
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 contributionsSub
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
protected function contributionsSub( $userObj, $targetName ) {
$isAnon = $userObj->isAnon();
if ( !$isAnon && $userObj->isHidden() &&
!$this->permissionManager->userHasRight( $this->getUser(), 'hideuser' )
) {
- 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 execute
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
// ConvertibleTimestamp::time() used so we can fake the current time in tests
$endTime = ConvertibleTimestamp::time() + self::MAX_EXECUTE_SECONDS;
$props = array_fill_keys( $this->getParameter( 'prop' ), true );
- 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 execute
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$services = $this->getServiceContainer();
$permissionManager = $services->getPermissionManager();
$request = $this->getRequest();
- 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 execute
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
global $IP;
// We want to allow "" for the wikidb, meaning don't call select_db()
$wiki = $this->hasOption( 'wikidb' ) ? $this->getOption( 'wikidb' ) : false;
- 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 doDBUpdates
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
protected function doDBUpdates() {
$mode = $this->getOption( 'mode', 'both' );
$begin = $this->getOption( 'begin', '' );
$throttle = $this->getOption( 'throttle', 0 );
- 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 execute
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
// Extensions will do stuff like $wgResourceModules += array(...) which is a
// fatal unless an array is already set. So set an empty value.
// And use the weird $__settings name to avoid any conflicts
// with real poorly named settings.
- 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 checkNamespace
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
private function checkNamespace( $ns, $name, $options ) {
$targets = $this->getTargetList( $ns, $name, $options );
$count = $targets->numRows();
$this->totalPages += $count;
if ( $count == 0 ) {
- 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 execute
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$username = $this->getArg( 0 );
$password = $this->getArg( 1 );
$force = $this->hasOption( 'force' );
$inGroups = [];
- 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
File PPFrame_Hash.php
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
File ParserCache.php
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Cache for outputs of the PHP parser
*
* This program is free software; you can redistribute it and/or modify
File LocalRepo.php
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Method execute
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$oldLayout = $this->getOption( 'oldlayout' );
if ( !in_array( $oldLayout, [ 'name', 'sha1' ] ) ) {
$this->fatalError( "Invalid old layout." );
}
Method cleanupTable
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function cleanupTable( $tableParams ) {
[ $table, $prefix ] = $tableParams;
$idField = $tableParams['idField'] ?? "{$prefix}_id";
$nsField = $tableParams['nsField'] ?? "{$prefix}_namespace";
$titleField = $tableParams['titleField'] ?? "{$prefix}_title";
Function updateUI
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.widgets.CalendarWidget.prototype.updateUI = function ( fade ) {
const $bodyWrapper = this.$bodyWrapper;
if ( this.lazyInitOnToggle ) {
// We're being called from the constructor and not being shown yet, do nothing
Method doTransform
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
if ( !$this->normaliseParams( $image, $params ) ) {
return new TransformParameterError( $params );
}
Method run
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function run( ApiPageSet $resultPageSet = null ) {
$db = $this->getDB();
$params = $this->extractRequestParams( false );
$result = $this->getResult();
LBFactory
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LBFactory implements ILBFactory {
/** @var CriticalSectionProvider|null */
private $csProvider;
/**
* @var callable|null An optional callback that returns a ScopedCallback instance,
Similar blocks of code found in 2 locations. Consider refactoring. Open
$namespaceAliases = [
'Medija' => NS_MEDIA,
'Specijalno' => NS_SPECIAL,
'Saradnik' => NS_USER,
'Suradnik' => NS_USER,
- 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 200.
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
$namespaceAliases = [ // Kept former namespaces for backwards compatibility - T155957
'Cithakan_Dhiskusi' => NS_TEMPLATE_TALK,
'Dhiskusi' => NS_TALK,
'Dhiskusi_$1' => NS_PROJECT_TALK,
'Dhiskusi_Cithakan' => NS_TEMPLATE_TALK,
- 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 200.
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