Showing 11,545 of 11,545 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
$oouiNodes.each( function () {
const data = $( this ).data( 'mw-modules' );
if ( data ) {
// We can trust this value, 'data-mw-*' attributes are banned from user content in Sanitizer
const extraModules = data.split( ',' );
- 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 72.
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
if (
!this.isDisabled() &&
!this.isFixed() &&
( e.keyCode === OO.ui.Keys.BACKSPACE || e.keyCode === OO.ui.Keys.DELETE )
) {
- 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 72.
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
if ( !this.stackLayout.isContinuous() && previousPage ) {
// This should not be necessary, since any inputs on the previous page should have
// been blurred when it was hidden, but browsers are not very consistent about
// this.
$focused = previousPage.$element.find( ':focus' );
- 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 72.
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
$( '<div>' ).addClass( 'suggestions-special' )
// Can't use click() because the container div is hidden when the
// textbox loses focus. Instead, listen for a mousedown followed
// by a mouseup on the same div.
.on( 'mousedown', ( e ) => {
- 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 72.
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 updateFieldsFromValue
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.widgets.datetime.DateTimeInputWidget.prototype.updateFieldsFromValue = function () {
let i, $field, spec, intercalary, sz;
const date = this.getValueAsDate();
Function renderUploadForm
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.ForeignStructuredUpload.BookletLayout.prototype.renderUploadForm = function () {
let fieldset,
layout = this;
// These elements are filled with text in #initialize
Function OoUiOutlineControlsWidget
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, config ) {
// Allow passing positional parameters inside the config object
if ( OO.isPlainObject( outline ) && config === undefined ) {
config = outline;
outline = config.outline;
Function _setOption
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setOption: function( key, value ) {
var i,
valsLength = 0;
if ( Array.isArray( this.options.values ) ) {
Function Request
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Request(input, options) {
if (!(this instanceof Request)) {
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
}
Method updateNotificationTimestamp
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateNotificationTimestamp(
UserIdentity $editor,
$target,
$timestamp
): array {
Method getRedirectTarget
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRedirectTarget( PageIdentity $page ): ?LinkTarget {
$cacheKey = self::makeCacheKey( $page );
$cachedValue = $this->procCache->get( $cacheKey );
if ( $cachedValue !== null ) {
return $cachedValue ?: null;
Method getEditButtons
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEditButtons( &$tabindex ) {
$buttons = [];
$labelAsPublish =
$this->context->getConfig()->get( MainConfigNames::EditSubmitButtonLabelPublish );
Method makeNewRevision
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeNewRevision(
CommentStoreComment $comment,
PageUpdateStatus $status
) {
$title = $this->getTitle();
Method getRenderedRevision
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRenderedRevision(
RevisionRecord $rev,
ParserOptions $options = null,
Authority $forPerformer = null,
array $hints = []
Method validate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate( $name, $value, array $settings, array $options ) {
static $codemap = [
-42 => 'notupload', // Local from getValue()
UPLOAD_ERR_FORM_SIZE => 'formsize',
UPLOAD_ERR_PARTIAL => 'partial',
Method internalGetCount
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function internalGetCount(
$metricName,
EntityKey $entity,
MetricSpec $metricSpec,
SequenceSpec $seqSpec,
Method doGetFileStatMulti
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doGetFileStatMulti( array $params ) {
$stats = [];
$reqs = []; // (path => op)
// (a) Check the containers of the paths...
Method get
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get( $key, &$casToken = null ) {
$getToken = ( func_num_args() >= 2 );
$this->_last_cmd_status = self::ERR_NONE;
Method sourceStream
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sourceStream(
$fp,
callable $lineCallback = null,
callable $resultCallback = null,
$fname = __METHOD__,
Method updateBlock
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateBlock( DatabaseBlock $block ) {
$this->logger->debug( 'Updating block; timestamp ' . $block->getTimestamp() );
$block->assertWiki( $this->wikiId );