Showing 37 of 74 total issues
Function destroy
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Plugin.prototype.destroy = function(d) {
var _this = this;
if (!d) {
Function Plugin
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Plugin(element, options) {
// Current lightGallery element
this.el = element;
Function isVideo
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Plugin.prototype.isVideo = function(src, index) {
var html;
if (this.s.dynamic) {
html = this.s.dynamicEl[index].html;
Function enableSwipe
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Plugin.prototype.enableSwipe = function() {
var _this = this;
var startCoords = 0;
var endCoords = 0;
var isMoved = false;
Function getThumb
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getThumb(src, thumb, index) {
var isVideo = _this.core.isVideo(src, index) || {};
var thumbImg;
var vimeoId = '';
Function build
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Plugin.prototype.build = function(index) {
var _this = this;
_this.structure();
Function actualSize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var actualSize = function(event, $image, index, fromIcon) {
var w = $image.width();
var nw;
if (_this.core.s.dynamic) {
nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWidth || w;
Avoid deeply nested control flow statements. Open
Open
if (_this.core.s.loadDailymotionThumbnail) {
thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1];
} else {
thumbImg = thumb;
}
Avoid deeply nested control flow statements. Open
Open
if (fL === '.' || fL === '#') {
html = $(html).html();
}
Avoid deeply nested control flow statements. Open
Open
if ((index === _length - 1) && (_prevIndex === 0) && !fromThumb) {
_prev = true;
_next = false;
}
Avoid deeply nested control flow statements. Open
Open
} else if (isVideo.vk) {
a = '&autoplay=' + autoplay;
if (this.core.s.vkPlayerParams) {
a = a + '&' + $.param(this.core.s.vkPlayerParams);
Consider simplifying this complex logical expression. Open
Open
if (_this.s.dynamic) {
_src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
} else {
_src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'));
Consider simplifying this complex logical expression. Open
Open
if (_this.core.doCss() && _this.core.$items.length > 1 && ((_this.core.s.enableSwipe && _this.core.isTouch) || (_this.core.s.enableDrag && !_this.core.isTouch))) {
_this.core.$el.on('onSlideClick.lg.tm', function() {
var $el = _this.core.$slide.eq(_this.core.index);
loadOnClick($el);
});
Function loadVideo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Video.prototype.loadVideo = function(src, addClass, noposter, index, html) {
Avoid too many return
statements within this function. Open
Open
return {
vk: vk
};
Method lightbox_attachments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def lightbox_attachments
case controller_name
when 'issues'
( @issue && @issue.attachments ) || []
when 'wiki'
- 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 generate_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def generate_for(attachment, force = false)
return nil unless can_generate_from?(attachment)
pdf_preview = attachment.pdf_preview
- 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"