Showing 15 of 21 total issues
File dropzone.js
has 920 lines of code (exceeds 250 allowed). Consider refactoring. Open
;(function(){
/**
* hasOwnProperty.
Function init
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Dropzone.prototype.init = function() {
var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1,
_this = this;
if (this.element.tagName === "form") {
Function Dropzone
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Dropzone(element, options) {
var elementOptions, extend, fallback, _ref;
this.element = element;
this.version = Dropzone.version;
Function uploadFile
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Dropzone.prototype.uploadFile = function(file) {
var formData, handleError, input, inputName, inputType, key, progressObj, value, xhr, _i, _len, _ref, _ref1, _ref2,
_this = this;
xhr = new XMLHttpRequest();
Function createThumbnail
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Dropzone.prototype.createThumbnail = function(file) {
var fileReader,
_this = this;
fileReader = new FileReader;
Function addEvent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
var addEvent = (function () {
if (document.addEventListener) {
return function (el, type, fn) {
if (el && el.nodeName || el === window) {
el.addEventListener(type, fn, 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
Method load_attachments_page
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def Util.load_attachments_page(params)
images = []
attachments = []
dir_config = get_attachment_directories(params)
dirs_to_crawl = [dir_config.image_dir, dir_config.file_dir]
- 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 onload
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
fileReader.onload = function() {
var img;
img = new Image;
img.onload = function() {
Function onload
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
img.onload = function() {
var canvas, ctx, srcHeight, srcRatio, srcWidth, srcX, srcY, thumbnail, trgHeight, trgRatio, trgWidth, trgX, trgY;
canvas = document.createElement("canvas");
ctx = canvas.getContext("2d");
Function discover
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Dropzone.discover = function() {
var checkElements, dropzone, dropzones, _i, _len, _results;
if (!Dropzone.autoDiscover) {
return;
Function relative
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
require.relative = function(parent) {
var p = require.normalize(parent, '..');
/**
* lastIndexOf helper.
Method editable_image
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def editable_image(options = {}, page)
key = options[:key]
image_source = nil
image_source = page.content[key] unless page.content.nil?
- 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
Method compose_link
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compose_link(block, options, page)
key = options[:key]
content_value = nil
content_value = page.content[key] unless page.content.nil?
href_attribute = nil
- 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
Consider simplifying this complex logical expression. Open
if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
if (!("classList" in document.createElement("a"))) {
capableBrowser = false;
} else {
_ref = Dropzone.blacklistedBrowsers;
Method build_templates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_templates(page_templates, page, key)
templates_concatenated = ''
page_templates.each_with_index do |t, index|
t.id = t.id.nil? ? index : t.id
- 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"