Showing 272 of 272 total issues
Function MWUploadWizardUploadInterface
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUploadInterface = function MWUploadWizardUploadInterface( upload ) {
var ui = this;
OO.EventEmitter.call( this );
Function getWikiText
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
getWikiText: function () {
var deed, info, key,
information,
wikiText = '';
Function checkUniqueProcessor
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkUniqueProcessor( data ) {
var result, protection, pageId, ntitle, ntitleObj, img;
result = { isUnique: true };
Function makePreview
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUpload.prototype.makePreview = function ( width ) {
var first, video, url, dataUrlReader,
deferred = $.Deferred(),
upload = this;
Function start
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function () {
var bar = this,
shown = false;
this.setBeginTime();
Function createLabel
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.LicenseGroup.prototype.createLabel = function ( name ) {
var licenseInfo = this.getLicenseInfo( name ),
messageKey = licenseInfo.props.msg === undefined ?
'[missing msg for ' + licenseInfo.name + ']' :
licenseInfo.props.msg,
Function processDestinationCheck
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.TitleDetailsWidget.prototype.processDestinationCheck = function ( result ) {
var messageParams, errors, titleString;
if ( result.unique.isUnique && result.blacklist.notBlacklisted && !result.unique.isProtected ) {
return [];
Function onGetPreferences
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function onGetPreferences( $user, &$preferences ) {
$config = Config::getConfig();
// User preference to skip the licensing tutorial, provided it's not globally disabled
if ( Config::getSetting( 'tutorial' ) != [] ) {
- 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 getHtml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function getHtml( $campaign = null ) {
global $wgLang;
$error = null;
$errorHtml = '';
- 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 addNextButton
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.ui.Upload.prototype.addNextButton = function () {
var ui = this;
this.nextButtonPromise.done( () => {
ui.$buttons.append(
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( latNum > 90 || latNum < -90 || ( latNum === 0 && latInput.indexOf( '0' ) < 0 ) || isNaN( latNum ) ) {
errors.push( mw.message( 'mwe-upwiz-error-latitude' ) );
}
- 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
uw.controller.Step.prototype.movePrevious = function () {
this.unload();
if ( this.previousStep ) {
this.previousStep.load( this.uploads );
- 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
uw.controller.Step.prototype.moveNext = function () {
this.unload();
if ( this.nextStep ) {
this.nextStep.load( this.uploads );
- 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 ( lonNum > 180 || lonNum < -180 || ( lonNum === 0 && lonInput.indexOf( '0' ) < 0 ) || isNaN( lonNum ) ) {
errors.push( mw.message( 'mwe-upwiz-error-longitude' ) );
}
- 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 getImageInfo
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUpload.prototype.getImageInfo = function ( callback, props, width, height ) {
var requestedTitle, params;
function ok( data ) {
var found;
Function UWLocationDetailsWidget
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.LocationDetailsWidget = function UWLocationDetailsWidget( config ) {
this.config = config || {};
uw.LocationDetailsWidget.super.call( this );
Function parseArrayValues
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function parseArrayValues( $array, Language $lang, $forKeys = null ) {
$parsed = [];
foreach ( $array as $key => $value ) {
if ( $forKeys !== null ) {
if ( in_array( $key, $forKeys ) ) {
- 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 modifyIfNecessary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function modifyIfNecessary() {
foreach ( $this->parsedConfig as $cnf => $modifiers ) {
if ( $cnf === 'whileActive' && $this->isActive() ) {
$activeModifiers = $modifiers;
} elseif ( $cnf === 'afterActive' && $this->wasActive() ) {
- 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 getApiThumbnail
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
mw.UploadWizardUpload.prototype.getApiThumbnail = function ( width, height ) {
var deferred = $.Deferred();
function thumbnailPublisher( thumbnails ) {
if ( thumbnails === null ) {
Function UWSingleLanguageInputWidget
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
uw.SingleLanguageInputWidget = function UWSingleLanguageInputWidget( config ) {
this.config = $.extend( {
inputWidgetConstructor: OO.ui.MultilineTextInputWidget.bind( null, {
classes: [ 'mwe-upwiz-singleLanguageInputWidget-text' ],
autosize: true