Showing 71 of 125 total issues
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 exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(locals){
var config = this.config;
var searchConfig = config.search;
var template = searchTmpl;
var searchfield = searchConfig.field;
Function Promise$2
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Promise$2 = function () {
function Promise(resolver) {
this[PROMISE_ID] = nextId();
this._result = this._state = undefined;
this._subscribers = [];
Function PrismPlugin
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function PrismPlugin(data) {
// Patch for caption support
if (captionRegex.test(data.content)) {
// Attempt to parse the code
data.content = data.content.replace(captionRegex, (origin, lang, caption, code) => {
Function _initBody
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this._initBody = function(body) {
this._bodyInit = body;
if (!body) {
this._bodyText = '';
} else if (typeof body === 'string') {
Function actualSize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var actualSize = function actualSize(event, image, index, fromIcon) {
var w = image.clientWidth;
var nw;
if (_this.core.s.dynamic) {
nw = _this.core.s.dynamicEl[index].width || image.naturalWidth || w;
Function off
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
off: function off(el, event) {
if (!el) {
return;
}
Function touchEnd
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Plugin.prototype.touchEnd = function (distance) {
var _this = this;
// keep slide animation for any mode while dragg/swipe
if (_this.s.mode !== 'lg-slide') {
Function all
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Promise.all = function (arr) {
var args = Array.prototype.slice.call(arr);
return new Promise(function (resolve, reject) {
if (args.length === 0) return resolve([]);
Function getProperty
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
function getProperty(obj, name){
name = name.replace(/\[(\w+)\]/g, '.$1').replace(/^\./, '');
var split = name.split('.');
var key = split.shift();
- 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
Avoid deeply nested control flow statements. Open
Open
if (!_this.lgBusy) {
_this.manageSwipeClass();
startCoords = e.pageX;
isDraging = true;
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
for (var key in utils.Listener) {
if (utils.Listener.hasOwnProperty(key)) {
if (key.split('.').indexOf(_event.split('.')[1]) > -1) {
el.removeEventListener(key.split('.')[0], utils.Listener[key]);
el.setAttribute('lg-event-uid', el.getAttribute('lg-event-uid').replace('&' + _id[i], ''));
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[index].getAttribute('data-download-url') !== 'false' && (_this.items[index].getAttribute('data-download-url') || _this.items[index].getAttribute('href') || _this.items[index].getAttribute('data-src'));
}
Function closest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
Element.prototype.closest = function(s) {
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
i,
el = this;
do {
- 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
Avoid too many return
statements within this function. Open
Open
return result;
Avoid too many return
statements within this function. Open
Open
return cachedSetTimeout.call(this, fun, 0);
Avoid too many return
statements within this function. Open
Open
return cachedClearTimeout.call(this, marker);
Avoid too many return
statements within this function. Open
Open
return {
vk: vk
};
Avoid too many return
statements within this function. Open
Open
if (typeof result !== 'object') return result;