Function ajaxUpload
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
function onLoadstart(e) {
fileSpan.removeClass('ajax-waiting');
fileSpan.addClass('ajax-loading');
Function addInlineAttachmentMarkup
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addInlineAttachmentMarkup(file) {
// insert uploaded image inline if dropped area is currently focused textarea
if($(handleFileDropEvent.target).hasClass('wiki-edit') && $.inArray(file.type, window.wikiImageMimeTypes) > -1) {
var $textarea = $(handleFileDropEvent.target);
var cursorPosition = $textarea.prop('selectionStart');
Function addInlineAttachmentMarkup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function addInlineAttachmentMarkup(file) {
// insert uploaded image inline if dropped area is currently focused textarea
if($(handleFileDropEvent.target).hasClass('wiki-edit') && $.inArray(file.type, window.wikiImageMimeTypes) > -1) {
var $textarea = $(handleFileDropEvent.target);
var cursorPosition = $textarea.prop('selectionStart');
- 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 uploadBlob
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function uploadBlob(blob, uploadUrl, attachmentId, options) {
var actualOptions = $.extend({
loadstartEventHandler: $.noop,
progressEventHandler: $.noop
Function addFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function addFile(inputEl, file, eagerUpload) {
var attachmentsFields = $(inputEl).closest('.attachments_form').find('.attachments_fields');
var addAttachment = $(inputEl).closest('.attachments_form').find('.add_attachment');
var maxFiles = ($(inputEl).attr('multiple') == 'multiple' ? 10 : 1);
- 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 addInputFiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function addInputFiles(inputEl) {
var attachmentsFields = $(inputEl).closest('.attachments_form').find('.attachments_fields');
var addAttachment = $(inputEl).closest('.attachments_form').find('.add_attachment');
var clearedFileInput = $(inputEl).clone().val('');
var sizeExceeded = false;
- 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 copyImageFromClipboard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function copyImageFromClipboard(e) {
if (!$(e.target).hasClass('wiki-edit')) { return; }
var clipboardData = e.clipboardData || e.originalEvent.clipboardData
if (!clipboardData) { return; }
if (clipboardData.types.some(function(t){ return /^text\/plain$/.test(t); })) { 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"