Showing 11,545 of 11,545 total issues
Method formatRow
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatRow( $row ) {
if ( $row->user_id == 0 ) { # T18487
return '';
}
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $mode ) {
$this->setHeaders();
$user = $this->getUser();
if ( !$user->isRegistered()
Method makeForm
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeForm() {
$fields = [
'Input' => [
'type' => 'textarea',
'label' => $this->msg( 'expand_templates_input' )->text(),
Method __construct
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
RevisionRecord $revRecord,
?RevisionRecord $previousRevRecord,
bool $showRollbackLink,
HookRunner $hookRunner,
Method handleError
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handleError(
$level,
$message,
$file = null,
$line = null
Method getHeadLinksAlternateURLsArray
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getHeadLinksAlternateURLsArray() {
$tags = [];
$languageUrls = [];
$action = $this->getContext()->getActionName();
$isCanonicalUrlAction = in_array( $action, [ 'history', 'info' ] );
Method claimOldest
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function claimOldest( $uuid ) {
$dbw = $this->getPrimaryDB();
$row = false; // the row acquired
do {
Method maybeMakeExternalImage
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function maybeMakeExternalImage( $url ) {
$imagesfrom = $this->mOptions->getAllowExternalImagesFrom();
$imagesexception = (bool)$imagesfrom;
$text = false;
# $imagesfrom could be either a single string or an array of strings, parse out the latter
Method pagesincategory
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function pagesincategory( $parser, $name = '', $arg1 = '', $arg2 = '' ) {
static $magicWords = null;
if ( $magicWords === null ) {
$magicWords = $parser->getMagicWordFactory()->newArray( [
'pagesincategory_all',
Method stripAltText
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function stripAltText( $caption, $holders ) {
# Strip bad stuff out of the title (tooltip). We can't just use
# replaceLinkHoldersText() here, because if this function is called
# from handleInternalLinks2(), mLinkHolders won't be up-to-date.
if ( $holders ) {
Method addUserToAutopromoteOnceGroups
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addUserToAutopromoteOnceGroups(
UserIdentity $user,
string $event
): array {
$user->assertWiki( $this->wikiId );
Method fileExistsBatch
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fileExistsBatch( array $files ) {
$results = [];
foreach ( $files as $k => $f ) {
if ( isset( $this->mFileExists[$f] ) ) {
$results[$k] = $this->mFileExists[$f];
Method debugMsg
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function debugMsg( $str, $context = [] ) {
global $wgDebugComments, $wgShowDebug;
if ( self::$enabled || $wgDebugComments || $wgShowDebug ) {
if ( $context ) {
Method doUpdates
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function doUpdates( $stage = self::ALL ) {
/** @var ErrorPageError $guiError First presentable client-level error thrown */
$guiError = null;
/** @var Throwable $exception First of any error thrown */
$exception = null;
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
if ( !( $this->hasOption( 'file' ) xor $this->hasOption( 'dump' ) ) ) {
$this->fatalError( "You must provide a file or dump" );
}
Method getRowsOld
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getRowsOld( $fromId ) {
$dbr = $this->getReplicaDB();
$batchSize = $this->getBatchSize();
$before = $this->getOption( 'before', false );
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
if ( $this->hasOption( 'tpl-time' ) ) {
$this->templateTimestamp = wfTimestamp( TS_MW, strtotime( $this->getOption( 'tpl-time' ) ) );
$hookContainer = $this->getHookContainer();
$hookContainer->register( 'BeforeParserFetchTemplateRevisionRecord', [ $this, 'onFetchTemplate' ] );
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$siteStore = $this->getServiceContainer()->getSiteStore();
if ( method_exists( $siteStore, 'reset' ) ) {
// @phan-suppress-next-line PhanUndeclaredMethod
$siteStore->reset();
Similar blocks of code found in 3 locations. Consider refactoring. Open
function makeRegexParser(regex) {
return function() {
var matches = rule.substr(pos).match(regex);
if (matches === null) {
- 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 3 locations. Consider refactoring. Open
OO.ui.WindowManager.prototype.isOpening = function ( win ) {
return win === this.currentWindow && !!this.lifecycle &&
this.lifecycle.isOpening();
};
- 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