File ve.init.mw.ArticleTarget.js
has 1483 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor MediaWiki Initialization ArticleTarget class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function saveFail
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, code, data ) {
this.pageDeletedWarning = false;
let handled = false;
// Handle empty response
- 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 getVisualDiffGeneratorPromise
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getVisualDiffGeneratorPromise = function () {
return mw.loader.using( 'ext.visualEditor.diffLoader' ).then( () => {
const mode = this.getSurface().getMode();
if ( !this.originalDmDocPromise ) {
- 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 saveComplete
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveComplete = function ( data ) {
this.editSummaryValue = null;
this.initialEditSummary = null;
this.saveDeferred.resolve();
Function renderCategories
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.renderCategories = function ( categoryItems ) {
const promises = [],
categories = { hidden: {}, normal: {} };
categoryItems.forEach( ( categoryItem, index ) => {
const attributes = ve.copy( ve.getProp( categoryItem, 'element', 'attributes' ) );
Function showSaveDialog
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxName ) {
let firstLoad = false;
if ( !this.isSaveable() || this.saveDialogIsOpening ) {
return;
Function restoreEditSection
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
const section = this.section !== null ? this.section : this.visibleSection;
const surface = this.getSurface();
const mode = surface.getMode();
- 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 save
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.save = function ( doc, options ) {
// Prevent duplicate requests
if ( this.saving ) {
return this.saving;
}
- 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 saveFail
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, code, data ) {
this.pageDeletedWarning = false;
let handled = false;
// Handle empty response
Function restoreEditSection
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
const section = this.section !== null ? this.section : this.visibleSection;
const surface = this.getSurface();
const mode = surface.getMode();
Function prepareCacheKey
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.prepareCacheKey = function ( doc ) {
const start = ve.now();
if ( this.getSurface().getMode() === 'source' ) {
return;
Function parseMetadata
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.parseMetadata = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data ) {
this.loadFail( 've-api', { errors: [ {
Function VeInitMwArticleTarget
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget = function VeInitMwArticleTarget( config ) {
config = config || {};
config.toolbarConfig = ve.extendObject( {
shadow: true,
actions: true,
Function save
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.save = function ( doc, options ) {
// Prevent duplicate requests
if ( this.saving ) {
return this.saving;
}
Function updateRedirectInterface
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.updateRedirectInterface = function ( $sub, $msg ) {
// For the subtitle, replace the real one with ours.
// This is more complicated than it should be because we have to fiddle with the <br>.
const $currentSub = $( '#redirectsub' );
if ( $currentSub.length ) {
- 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 getVisualDiffGeneratorPromise
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getVisualDiffGeneratorPromise = function () {
return mw.loader.using( 'ext.visualEditor.diffLoader' ).then( () => {
const mode = this.getSurface().getMode();
if ( !this.originalDmDocPromise ) {
Function loadSuccess
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data || typeof data.content !== 'string' ) {
this.loadFail( 've-api', { errors: [ {
Function getSaveFields
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSaveFields = function () {
const fields = {};
if ( this.section === 'new' ) {
// MediaWiki action=edit UI doesn't have separate parameters for edit summary and new section
- 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 parseMetadata
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.parseMetadata = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data ) {
this.loadFail( 've-api', { errors: [ {
- 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 loadSuccess
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
const data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
if ( !data || typeof data.content !== 'string' ) {
this.loadFail( 've-api', { errors: [ {
- 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 onSaveDialogPreview
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.onSaveDialogPreview = function () {
const api = this.getContentApi();
if ( !this.saveDialog.$previewViewer.children().length ) {
this.emit( 'savePreview' );
Function surfaceReady
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
const accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
surfaceModel = this.getSurface().getModel();
Function preparedCacheKeyPromise
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then( ( deflatedHtml ) => {
if ( aborted ) {
return ve.createDeferred().reject();
}
xhr = this.getContentApi().postWithToken( 'csrf',
Function updateRedirectInterface
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.updateRedirectInterface = function ( $sub, $msg ) {
// For the subtitle, replace the real one with ours.
// This is more complicated than it should be because we have to fiddle with the <br>.
const $currentSub = $( '#redirectsub' );
if ( $currentSub.length ) {
Function surfaceReady
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.surfaceReady = function () {
const accessKeyPrefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix().replace( /-/g, '+' ),
accessKeyModifiers = new ve.ui.Trigger( accessKeyPrefix + '-' ).modifiers,
surfaceModel = this.getSurface().getModel();
- 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 tryWithPreparedCacheKey
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.tryWithPreparedCacheKey = function ( doc, extraData, eventName ) {
if ( this.getSurface().getMode() === 'source' ) {
const data = ve.copy( extraData );
// TODO: This should happen in #getSaveOptions, check if moving it there breaks anything
Function teardown
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.teardown = function () {
if ( !this.teardownPromise ) {
const surface = this.getSurface();
// Restore access keys
- 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 submit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.submit = function ( wikitext, fields ) {
// Prevent duplicate requests
if ( this.submitting ) {
return false;
}
Function getSaveButtonLabel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSaveButtonLabel = function ( startProcess, forceShort ) {
const suffix = startProcess ? '-start' : '';
if ( forceShort || OO.ui.isMobile() ) {
// The following messages can be used here:
- 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 replacePageContent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
html, categoriesHtml, displayTitle, lastModified, contentSub, sections
Function saveComplete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveComplete = function ( data ) {
this.editSummaryValue = null;
this.initialEditSummary = null;
this.saveDeferred.resolve();
- 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 onSaveDialogPreview
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.onSaveDialogPreview = function () {
const api = this.getContentApi();
if ( !this.saveDialog.$previewViewer.children().length ) {
this.emit( 'savePreview' );
- 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 VeInitMwArticleTarget
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget = function VeInitMwArticleTarget( config ) {
config = config || {};
config.toolbarConfig = ve.extendObject( {
shadow: true,
actions: true,
- 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 prepareCacheKey
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.prepareCacheKey = function ( doc ) {
const start = ve.now();
if ( this.getSurface().getMode() === 'source' ) {
return;
- 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 setDefaultMode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.setDefaultMode = function () {
const oldDefaultMode = this.defaultMode;
// Parent method
ve.init.mw.ArticleTarget.super.prototype.setDefaultMode.apply( this, arguments );
- 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 switchToWikitextEditor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.switchToWikitextEditor = function ( modified ) {
// When switching with changes we always pass the full page as changes in visual section mode
// can still affect the whole document (e.g. removing a reference)
if ( modified ) {
this.section = null;
- 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 onSaveDialogReview
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.onSaveDialogReview = function () {
if ( !this.saveDialog.hasDiff ) {
this.emit( 'saveReview' );
this.saveDialog.pushPending();
// Acquire a temporary user username before diffing, so that signatures and
- 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 getSectionHashFromPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSectionHashFromPage = function () {
// Assume there are section edit links, as the user just did a section edit. This also means
// that the section numbers line up correctly, as not every H_ tag is a numbered section.
const $sections = this.$editableContent.find( '.mw-editsection' );
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.getSurfaceClasses = function () {
const classes = ve.init.mw.ArticleTarget.super.prototype.getSurfaceClasses.call( this );
return [ ...classes, 'mw-body-content' ];
};
- 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 83.
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
for ( const key in params ) {
$form.append( $( '<input>' ).attr( { type: 'hidden', name: key, value: params[ key ] } ) );
}
- 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 61.
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
ve.init.mw.ArticleTarget.prototype.saveErrorUnknown = function ( data ) {
this.showSaveError( this.extractErrorMessages( data ) );
};
- 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 56.
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
ve.init.mw.ArticleTarget.prototype.saveErrorHookAborted = function ( data ) {
this.showSaveError( this.extractErrorMessages( data ) );
};
- 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 56.
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
this.wikitextDiffPromise = this.tryWithPreparedCacheKey( doc, {
paction: 'diff',
page: this.getPageName(),
oldid: this.revid,
etag: this.etag
- 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 52.
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
const promise = this.serializing = this.tryWithPreparedCacheKey( doc, {
paction: 'serialize',
page: this.getPageName(),
oldid: this.revid,
etag: this.etag
- 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 52.
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
$( '[accesskey=' + key + ']' ).each( ( i, el ) => {
const $el = $( el );
$el
.attr( 'data-old-accesskey', $el.attr( 'accesskey' ) )
- 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 48.
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
$( '[data-old-accesskey]' ).each( ( i, el ) => {
const $el = $( el );
$el
.attr( 'accesskey', $el.attr( 'data-old-accesskey' ) )
- 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 48.
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
this.loadFail( 've-api', { errors: [ {
code: 've-api',
html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
} ] } );
- 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 46.
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
this.loadFail( 've-api', { errors: [ {
code: 've-api',
html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
} ] } );
- 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 46.
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