Showing 912 of 912 total issues
Function getActionProcess
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.getActionProcess = function ( action ) {
let handler;
switch ( action ) {
case 'change':
File ve.ui.MWTransclusionOutlineTemplateWidget.js
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Container for a template as rendered in the template dialog sidebar.
* Contains search and visibility inputs, and a list of parameters when available.
*
* @class
Function getLookupRequest
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTemplateTitleInputWidget.prototype.getLookupRequest = function () {
let promise = ve.ui.MWTemplateTitleInputWidget.super.prototype.getLookupRequest.call( this );
if ( mw.config.get( 'wgVisualEditorConfig' ).cirrusSearchLookup ) {
promise = promise
.then( this.addExactMatch.bind( this ) )
Similar blocks of code found in 2 locations. Consider refactoring. Open
ve.ui.MWLanguageVariantDisabledInspector.prototype.getReadyProcess = function ( data ) {
return ve.ui.MWLanguageVariantDisabledInspector.super.prototype.getReadyProcess.call( this, data )
.next( () => {
this.textTarget.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 88.
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.ui.MWLanguageVariantFilterInspector.prototype.getReadyProcess = function ( data ) {
return ve.ui.MWLanguageVariantFilterInspector.super.prototype.getReadyProcess.call( this, data )
.next( () => {
this.textTarget.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 88.
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 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 createValueInput
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWParameterPage.prototype.createValueInput = function () {
const type = this.parameter.getType(),
value = this.parameter.getValue(),
valueInputConfig = this.getDefaultInputConfig();
Function toDomElements
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter ) {
// ImageNode:
// <li> li (gallerybox)
// <div> thumbDiv
// <span> container
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 teardown
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWSettingsPage.prototype.teardown = function ( data ) {
// Data initialisation
data = data || {};
if ( data.action !== 'done' ) {
return;
Function toDomElements
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, converter ) {
const store = converter.getStore(),
originalMw = dataElement.attributes.originalMw,
originalDomElements = store.value( dataElement.originalDomElementsHash );
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.highlightedCaptionTarget = ve.init.target.createTargetWidget( {
includeCommands: this.constructor.static.includeCommands,
excludeCommands: this.constructor.static.excludeCommands,
importRules: this.constructor.static.getImportRules(),
multiline: false
- 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 87.
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.captionTarget = ve.init.target.createTargetWidget( {
includeCommands: this.constructor.static.includeCommands,
excludeCommands: this.constructor.static.excludeCommands,
importRules: this.constructor.static.getImportRules(),
multiline: false
- 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 87.
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 toDomElements
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWInlineImageNode.static.toDomElements = function ( dataElement, doc, converter ) {
const attributes = dataElement.attributes,
container = doc.createElement( 'span' ),
imgWrapper = doc.createElement( attributes.href ? 'a' : 'span' ),
img = doc.createElement( attributes.isError ? 'span' : attributes.mediaTag ),
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 buildMediaInfoPanel
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaDialog.prototype.buildMediaInfoPanel = function ( imageinfo ) {
const contentDirection = this.getFragment().getDocument().getDir(),
imageTitleText = imageinfo.title || imageinfo.canonicaltitle,
imageTitle = new OO.ui.LabelWidget( {
label: mw.Title.newFromText( imageTitleText ).getNameText()
- 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 VeUiMWMediaInfoFieldWidget
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWMediaInfoFieldWidget = function VeUiMWMediaInfoFieldWidget( content, config ) {
// Configuration initialization
config = config || {};
// Parent constructor
- 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 toDataElement
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter ) {
const container = domElements[ 0 ]; // <span>
if ( !container.children.length ) {
// Malformed image, alienate (T267282)
return 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 toDomElements
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWBlockImageNode.static.toDomElements = function ( data, doc, converter ) {
const dataElement = data[ 0 ],
attributes = dataElement.attributes,
figure = doc.createElement( 'figure' ),
imgWrapper = doc.createElement( attributes.href ? 'a' : 'span' ),