Showing 11,545 of 11,545 total issues
Method saveUserGroups
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveUserGroups( string $reason, UserIdentity $user ) {
if ( $this->userNameUtils->isTemp( $user->getName() ) ) {
return Status::newFatal( 'userrights-no-tempuser' );
}
Method formatResult
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatResult( $skin, $result ) {
$fromObj = Title::makeTitle( $result->namespace, $result->title );
if ( isset( $result->rd_title ) ) {
$toObj = Title::makeTitle(
$result->rd_namespace,
Method getQueryInfo
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getQueryInfo() {
$opts = $this->opts;
$conds = [];
$dbr = $this->getDatabase();
$tables = [ 'image', 'actor' ];
Method output
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output( Throwable $e, $mode, Throwable $eNew = null ) {
$showExceptionDetails = self::shouldShowExceptionDetails();
if ( $e instanceof RequestTimeoutException && headers_sent() ) {
// Excimer's flag check happens on function return, so, a timeout
// can be thrown after exiting, say, `doPostOutputShutdown`, where
Method pushBlobs
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function pushBlobs( RedisConnRef $conn, array $items ) {
$args = [ $this->encodeQueueName() ];
// Next args come in 4s ([id, sha1, rtime, blob [, id, sha1, rtime, blob ... ] ] )
foreach ( $items as $item ) {
$args[] = (string)$item['uuid'];
Method normalizeLinkUrl
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function normalizeLinkUrl( $url ) {
# Test for RFC 3986 IPv6 syntax
$scheme = '[a-z][a-z0-9+.-]*:';
$userinfo = '(?:[a-z0-9\-._~!$&\'()*+,;=:]|%[0-9a-f]{2})*';
$ipv6Host = '\\[((?:[0-9a-f:]|%3[0-A]|%[46][1-6])+)\\]';
Method getPageInfo
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPageInfo( $pageConfigOrTitle, array $titles ): array {
if ( $pageConfigOrTitle instanceof IPageConfig ) {
$context_title = Title::newFromLinkTarget(
$pageConfigOrTitle->getLinkTarget()
);
Method getMessageParameters
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getMessageParameters() {
if ( $this->parsedParametersDeleteLog !== null ) {
return $this->parsedParametersDeleteLog;
}
Method saveSettings
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveSettings() {
if ( MediaWikiServices::getInstance()->getReadOnlyMode()->isReadOnly() ) {
// @TODO: caller should deal with this instead!
// This should really just be an exception.
MWExceptionHandler::logException( new DBExpectedError(
Method formatParameterValueForApi
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatParameterValueForApi( $name, $type, $value ) {
$type = strtolower( trim( $type ) );
switch ( $type ) {
case 'bool':
$value = (bool)$value;
Method __construct
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( array $info = null ) {
// Verify required settings presence
if (
$info === null
|| !array_key_exists( 'name', $info )
Method load
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function load() {
if ( $this->procCache !== null ) {
return; // already loaded
}
Method getAutosummary
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAutosummary(
Content $oldContent = null,
Content $newContent = null,
$flags = 0
) {
Method parseQuery
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseQuery( $filteredText, $fulltext ) {
$lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); // Minus syntax chars (" and *)
$searchon = '';
$this->searchTerms = [];
Method loadWithArgv
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadWithArgv( array $argv, int $skip = 0 ) {
$this->clear();
$options = [];
$args = [];
Method showReport
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showReport() {
if ( !$this->prefetch ) {
parent::showReport();
return;
Method execute
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$file = $this->getOption( 'file',
__DIR__ . '/data/CommentFormatter/rc100-2021-07-29.json' );
$json = file_get_contents( $file );
if ( !$json ) {
Method execute
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
# Options processing
$username = $this->getOption( 'u', false );
$reason = $this->getOption( 'r', '' );
$interval = $this->getOption( 'i', 0 );
Similar blocks of code found in 3 locations. Consider refactoring. Open
OO.ui.ComboBoxInputWidget.prototype.setDisabled = function () {
// Parent method
OO.ui.ComboBoxInputWidget.super.prototype.setDisabled.apply( this, arguments );
this.updateControlsDisabled();
return this;
- 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 79.
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.ComboBoxInputWidget.prototype.setReadOnly = function () {
// Parent method
OO.ui.ComboBoxInputWidget.super.prototype.setReadOnly.apply( this, arguments );
this.updateControlsDisabled();
return this;
- 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 79.
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