Showing 260 of 260 total issues
Function load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ui.Details.prototype.load = function ( uploads ) {
uw.ui.Step.prototype.load.call( this, uploads );
if ( mw.UploadWizard.config.wikibase.enabled && mw.UploadWizard.config.wikibase.captions ) {
this.$div.prepend(
Function thumbnailPublisher
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function thumbnailPublisher( thumbnails ) {
if ( thumbnails === null ) {
// the api call failed somehow, no thumbnail data.
deferred.resolve( null );
} else {
Function createImagePickerField
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUploadInterface.prototype.createImagePickerField = function ( index, setDisabled ) {
var $fieldContainer = $( '<div>' ).addClass( 'mwe-upwiz-objref-pick-image' ),
attributes = {
type: 'checkbox',
class: 'imgPicker',
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.purposeRadio.on( 'select', ( selectedOption ) => {
revealOptionContent( self.purposeRadio.$element, selectedOption.$element );
// let's also emit a 'change' event to satisfy the listener that checks
// and shows/hides an error message
- 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 62.
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.originOthersRadio.on( 'select', ( selectedOption ) => {
revealOptionContent( self.originOthersRadio.$element, selectedOption.$element );
// let's also emit a 'change' event on the parent radio to satisfy the listener
// that checks and shows/hides an error message
- 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 62.
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 initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.PatentDialog.prototype.initialize = function () {
var filenames = [],
label = new OO.ui.LabelWidget(),
panels = new OO.ui.PanelLayout( { padded: true, expanded: false } );
Method execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $subPage ) {
$request = $this->getRequest();
$start = $request->getIntOrNull( 'start' );
Function UWStatementWidget
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.StatementWidget = function UWStatementWidget( config ) {
var EntityInputWidget =
mw.loader.require( 'wikibase.mediainfo.statements' ).inputs.EntityInputWidget,
FormatValueElement =
mw.loader.require( 'wikibase.mediainfo.base' ).FormatValueElement;
Similar blocks of code found in 3 locations. Consider refactoring. Open
this.retryButtonSomeFailed = new OO.ui.ButtonWidget( {
label: mw.message( 'mwe-upwiz-file-retry' ).text(),
flags: [ 'progressive', 'primary' ]
} ).on( 'click', startDetails );
- 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 3 locations. Consider refactoring. Open
this.nextButton = new OO.ui.ButtonWidget( {
label: mw.message( 'mwe-upwiz-publish-details' ).text(),
flags: [ 'progressive', 'primary' ]
} ).on( 'click', startDetails );
- 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 3 locations. Consider refactoring. Open
this.retryButtonAllFailed = new OO.ui.ButtonWidget( {
label: mw.message( 'mwe-upwiz-file-retry' ).text(),
flags: [ 'progressive', 'primary' ]
} ).on( 'click', startDetails );
- 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
Function getStashImageInfo
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUpload.prototype.getStashImageInfo = function ( callback, props, width, height ) {
var params = {
prop: 'stashimageinfo',
siifilekey: this.fileKey,
siiprop: props.join( '|' )
Function getApi
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
getApi: function ( options ) {
var api = new mw.Api( options );
api.ajax = function ( parameters, ajaxOptions ) {
var original, override;
Function validateTitleInput
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.TitleDetailsWidget.prototype.validateTitleInput = function ( value ) {
var
errors = [],
processDestinationCheck = this.processDestinationCheck,
title = this.buildTitleFromInput( value ),
Function setValues
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
setValues: function ( values, groupName ) {
var selectedGroups = [];
var input = this;
this.getItems().forEach( ( group ) => {
Function execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $subPage ) {
// side effects: if we can't upload, will print error page to wgOut
// and return false
if ( !( $this->isUploadAllowed() && $this->isUserUploadAllowed( $this->getUser() ) ) ) {
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 UploadWizardLicenseInput
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
mw.UploadWizardLicenseInput = function ( config, count, api ) {
mw.UploadWizardLicenseInput.super.call( this );
OO.ui.mixin.GroupElement.call( this );
this.count = count;
- 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 UWUITutorial
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ui.Tutorial = function UWUITutorial() {
var ui = this;
uw.ui.Step.call(
this,
Function UWDeedInterface
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.deed.Abstract = function UWDeedInterface( name, config, uploads ) {
var tcName, details, field, input;
this.name = name;
this.config = config;
uw.deed.Abstract.prototype.instanceCount++;
Function setImageURL
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
setImageURL: function ( index ) {
var upload = this.imageUploads[ index ];
var photoId = upload.photoId;
var checker = this;