Showing 141 of 272 total issues
Function checkStatus
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
mw.FormDataTransport.prototype.checkStatus = function () {
var transport = this,
params = OO.cloneObject( this.formData );
if ( this.aborted ) {
Function validateFile
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.controller.Upload.prototype.validateFile = function ( upload ) {
var extension,
i,
actualMaxSize = mw.UploadWizard.config.maxMwUploadSize,
Function checkFlickr
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
checkFlickr: function ( flickrInputUrl ) {
var photoIdMatches, albumIdMatches, userCollectionMatches, userPhotostreamMatches, groupPoolMatches, userGalleryMatches, userFavoritesMatches;
photoIdMatches = flickrInputUrl.match( /flickr\.com\/(?:x\/t\/[^/]+\/)?photos\/[^/]+\/([0-9]+)/ );
albumIdMatches = flickrInputUrl.match( /flickr\.com\/photos\/[^/]+\/(sets|albums)\/([0-9]+)/ );
- 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 initialiseSteps
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialiseSteps: function () {
var self = this,
steps = {};
steps.tutorial = new uw.controller.Tutorial( this.api, this.config );
Method getImageHtml
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getImageHtml( MediaTransformOutput $thumb, $tutorial ) {
$helpDeskUrl = wfMessage( 'mwe-upwiz-help-desk-url' )->text();
// Per convention, we may be either using an absolute URL or a wiki page title in this UI message
if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $helpDeskUrl ) ) {
Method getWizardHtml
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getWizardHtml() {
$config = Config::getConfig( $this->campaign );
if ( array_key_exists(
'display', $config ) && array_key_exists( 'headerLabel', $config['display'] )
Function valid
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.controller.Details.prototype.valid = function () {
// validityPromises will hold all promises for all uploads;
// prefilling with a bogus promise (no warnings & errors) to
// ensure $.when always resolves with an array of multiple
// results (if there's just 1, it would otherwise have just
Method getHtml
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getHtml( $campaign = null ) {
global $wgLang;
$error = null;
$errorHtml = '';
Function checkFlickr
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
checkFlickr: function ( flickrInputUrl ) {
var photoIdMatches, albumIdMatches, userCollectionMatches, userPhotostreamMatches, groupPoolMatches, userGalleryMatches, userFavoritesMatches;
photoIdMatches = flickrInputUrl.match( /flickr\.com\/(?:x\/t\/[^/]+\/)?photos\/[^/]+\/([0-9]+)/ );
albumIdMatches = flickrInputUrl.match( /flickr\.com\/photos\/[^/]+\/(sets|albums)\/([0-9]+)/ );
Function addNextButton
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.ui.Details.prototype.addNextButton = function () {
var ui = this;
this.nextButtonPromise.done( () => {
ui.$buttons.append(
Function UWLicenseGroup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.LicenseGroup = function UWLicenseGroup( config, type, api, count ) {
var self = this;
uw.LicenseGroup.super.call( this, {} );
Function prefillLocation
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prefillLocation: function () {
var dir,
m = this.upload.imageinfo.metadata,
values = {};
Function copyMetadata
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.CopyMetadataWidget.prototype.copyMetadata = function ( metadataTypes ) {
var titleZero, matches, i,
uploads = this.copyTo,
sourceUpload = this.copyFrom,
serialized = sourceUpload.details.getSerialized(),
Function addUpload
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.ui.Thanks.prototype.addUpload = function ( upload ) {
var thumbWikiText, $thanksDiv, $thumbnailWrapDiv, $thumbnailDiv, $thumbnailCaption, $thumbnailLink;
thumbWikiText = '[[' + [
upload.details.getTitle().getPrefixedText(),
Function setupDateInput
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.DateDetailsWidget.prototype.setupDateInput = function ( mode ) {
var
oldDateInputWidget = this.dateInputWidget;
if ( mode === undefined ) {
Function submitWikiText
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
submitWikiText: function ( wikiText ) {
var params,
tags = [ 'uploadwizard' ],
deed = this.upload.deedChooser.deed,
comment = '',
Function validateTitleInput
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
uw.TitleDetailsWidget.prototype.validateTitleInput = function ( value ) {
var
errors = [],
processDestinationCheck = this.processDestinationCheck,
title = this.buildTitleFromInput( value ),
Function createImagePickerField
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
mw.UploadWizardUploadInterface.prototype.createImagePickerField = function ( index, setDisabled ) {
var $fieldContainer = $( '<div>' ).addClass( 'mwe-upwiz-objref-pick-image' ),
attributes = {
type: 'checkbox',
class: 'imgPicker',
Function thumbnailPublisher
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function thumbnailPublisher( thumbnails ) {
if ( thumbnails === null ) {
// the api call failed somehow, no thumbnail data.
deferred.resolve( null );
} else {
Method execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( $subPage ) {
$request = $this->getRequest();
$start = $request->getIntOrNull( 'start' );