Showing 11,545 of 11,545 total issues
File namespaceDupes.php
has 511 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Check for articles to fix after adding/deleting namespaces
*
* Copyright © 2005-2007 Brooke Vibber <bvibber@wikimedia.org>
Function doUpdateRestrictions
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public function doUpdateRestrictions( array $limit, array $expiry,
&$cascade, $reason, UserIdentity $user, $tags = []
) {
$services = MediaWikiServices::getInstance();
$readOnlyMode = $services->getReadOnlyMode();
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ( 'name' in config ) {
// Use this instead of <input type="hidden">, because hidden inputs do not have separate
// 'value' and 'defaultValue' properties. The script on Special:Preferences
// (mw.special.preferences.confirmClose) checks this property to see if a field was changed.
this.$hiddenInput = $( '<textarea>' )
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ( 'name' in config ) {
// Use this instead of <input type="hidden">, because hidden inputs do not have separate
// 'value' and 'defaultValue' properties. The script on Special:Preferences
// (mw.special.preferences.confirmClose) checks this property to see if a field was changed.
this.$hiddenInput = $( '<textarea>' )
- 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
Function makeApi
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeApi(sinon) {
function getCallbackError(behavior, func, args) {
if (behavior.callArgAt < 0) {
var msg;
Method getFormFields
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFormFields() {
$conf = $this->getConfig();
$blockAllowsUTEdit = $conf->get( MainConfigNames::BlockAllowsUTEdit );
$this->getOutput()->enableOOUI();
File MultiHttpClient.php
has 507 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* HTTP service client
*
* This program is free software; you can redistribute it and/or modify
ChangesListSpecialPage
has 57 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class ChangesListSpecialPage extends SpecialPage {
/** @var string */
protected $rcSubpage;
DatabaseUpdater
has 57 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class DatabaseUpdater {
public const REPLICATION_WAIT_TIMEOUT = 300;
/**
* Array of updates to perform on the database
Method execute
has 204 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function execute() {
$text = $this->text;
# Parsing through the text line by line. The main thing
# happening here is handling of block-level elements p, pre,
# and making lists from lines starting with * # : etc.
Function segmentSplitter
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
public static function segmentSplitter( $filename ) {
$showXMP = XMPReader::isSupported();
$segmentCount = 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 52 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
// Parameter validation
$this->requireAtLeastOneParameter(
- 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 processTitlesArray
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
private function processTitlesArray( $titles ) {
$linkBatch = $this->linkBatchFactory->newLinkBatch();
/** @var Title[] $titleObjects */
$titleObjects = [];
- 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 statelessFetchTemplate
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
public static function statelessFetchTemplate( $page, $parser = false ) {
$title = Title::castFromLinkTarget( $page ); // for compatibility with return type
$text = $skip = false;
$finalTitle = $title;
$deps = [];
- 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 generateFirstChars
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
private function generateFirstChars() {
$file = fopen( "{$this->dataDir}/allkeys.txt", 'r' );
if ( !$file ) {
$this->fatalError( "Unable to open allkeys.txt" );
}
- 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 52 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$backendGroup = $this->getServiceContainer()->getFileBackendGroup();
$src = $backendGroup->get( $this->getOption( 'src' ) );
$dst = $backendGroup->get( $this->getOption( 'dst' ) );
$containers = explode( '|', $this->getOption( 'containers' ) );
- 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
Method expand
has 202 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function expand( $root, $flags = 0 ) {
static $expansionDepth = 0;
if ( is_string( $root ) ) {
return $root;
}
File ParamValidator.php
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Wikimedia\ParamValidator;
use DomainException;
File MimeMap.php
has 502 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 ApiQueryWatchlist.php
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify