Showing 11,545 of 11,545 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
$namespaceAliases = [
# Aliases to kk-cyrl namespaces
'Таспа' => NS_MEDIA,
'Арнайы' => NS_SPECIAL,
'Талқылау' => NS_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 280.
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
TransactionManager
has 66 functions (exceeds 20 allowed). Consider refactoring. Open
class TransactionManager {
/** Transaction is in a error state requiring a full or savepoint rollback */
public const STATUS_TRX_ERROR = 1;
/** Transaction is active and in a normal state */
public const STATUS_TRX_OK = 2;
File DeletePage.php
has 569 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Page;
use BadMethodCallException;
Similar blocks of code found in 2 locations. Consider refactoring. Open
do {
if (s.pending === s.pending_buf_size) {
//--- HCRC_UPDATE(beg) ---//
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
- 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 227.
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
do {
if (s.pending === s.pending_buf_size) {
//--- HCRC_UPDATE(beg) ---//
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
- 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 227.
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 extractRowInfo
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
private function extractRowInfo( $row ) {
$logEntry = DatabaseLogEntry::newFromRow( $row );
$vals = [
ApiResult::META_TYPE => 'assoc',
];
- 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 showIndirectLinks
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showIndirectLinks(
$level, LinkTarget $target, $limit, $offsetNamespace = 0, $offsetPageID = 0, $dir = 'next'
) {
$out = $this->getOutput();
$dbr = $this->dbProvider->getReplicaDatabase();
File util.js
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
let config = require( './config.json' );
const portletLinkOptions = require( './portletLinkOptions.json' );
const infinityValues = require( './infinityValues.json' );
Method execute
has 238 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
$activeUserDays = $this->getConfig()->get( MainConfigNames::ActiveUserDays );
$db = $this->getDB();
ApiPageSet
has 65 functions (exceeds 20 allowed). Consider refactoring. Open
class ApiPageSet extends ApiBase {
/**
* Constructor flag: The new instance of ApiPageSet will ignore the 'generator=' parameter
* @since 1.21
*/
File jquery.ui.resizable.js
has 561 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jQuery UI Resizable 1.9.2
* http://jqueryui.com
*
* Copyright 2012 jQuery Foundation and other contributors
File ThumbnailEntryPoint.php
has 561 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Entry point implementation for retrieving media thumbnails, created by a MediaHandler
* subclass or proxy request if FileRepo::getThumbProxyUrl is configured.
*
Function run
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
private function run( $resultPageSet = null ) {
$db = $this->getDB();
$params = $this->extractRequestParams();
- 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 60 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$user = $this->getUser();
if ( !$user->isRegistered() ) {
$this->dieWithError( 'watchlistanontext', 'notloggedin' );
- 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 doVariants
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
protected function doVariants( &$classes ) {
$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
$linkBatch = $linkBatchFactory->newLinkBatch();
$variantMap = []; // maps $pdbkey_Variant => $keys (of link holders)
$output = $this->parent->getOutput();
- 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 renderImageGallery
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
public function renderImageGallery( $text, array $params ) {
$mode = false;
if ( isset( $params['mode'] ) ) {
$mode = $params['mode'];
}
- 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 doMoveToExternal
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
private function doMoveToExternal() {
$success = true;
$dbr = $this->getReplicaDB();
$count = $this->maxID - $this->minID + 1;
- 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 IntroMessageBuilder.php
has 559 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\EditPage;
use LogEventsList;
File SiteConfig.php
has 558 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright (C) 2011-2022 Wikimedia Foundation and others.
*
* This program is free software; you can redistribute it and/or modify
Method loadSessionInfoFromStore
has 234 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loadSessionInfoFromStore( SessionInfo &$info, WebRequest $request ) {
$key = $this->store->makeKey( 'MWSession', $info->getId() );
$blob = $this->store->get( $key );
// If we got data from the store and the SessionInfo says to force use,