Showing 72 of 103 total issues
File holder.js
has 3089 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
Holder - client side image placeholders
Version 2.9.9+jl7z
© 2021 Ivan Malopinsky - https://imsky.co
Function buildSceneGraph
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildSceneGraph(scene) {
var fontSize = App.defaults.size;
var fixedSize = scene.flags.fixedSize != null ? scene.flags.fixedSize : scene.theme.fixedSize;
if (parseFloat(scene.theme.size)) {
fontSize = scene.theme.size;
Function shaven
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function shaven(arrayOrObject) {
var isArray = Array.isArray(arrayOrObject);
var objType = typeof arrayOrObject === 'undefined' ? 'undefined' : _typeof(arrayOrObject);
if (!isArray && objType !== 'object') {
Function prepareDOMElement
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function prepareDOMElement(prepSettings) {
var mode = prepSettings.mode;
var el = prepSettings.el;
var flags = prepSettings.flags;
var _engineSettings = prepSettings.engineSettings;
Function run
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
run: function(userOptions) {
//todo: split processing into separate queues
userOptions = userOptions || {};
var engineSettings = {};
var options = extend(App.settings, userOptions);
Function _onDomReady
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _onDomReady(win) {
//Lazy loading fix for Firefox < 3.6
//http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
if (document.readyState == null && document.addEventListener) {
document.addEventListener("DOMContentLoaded", function DOMContentLoaded() {
Function SceneGraph
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var SceneGraph = function(sceneProperties) {
var nodeCount = 1;
//todo: move merge to helpers section
function merge(parent, child) {
Function buildDom
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildDom(elemArray) {
if (Array.isArray(elemArray) && elemArray.length === 0) {
// Ignore empty arrays
return {};
}
Class ProjectsController
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ProjectsController < ApplicationController
before_action :find_project_by_id
before_action :redirect_to_slug, only: [:show]
load_and_authorize_resource find_by: :url
skip_before_action :authenticate_user!, only: %i[index show archived finished newest popular biggest random]
Function formatValue
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
Function render
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function render(renderSettings) {
var image = null;
var mode = renderSettings.mode;
var el = renderSettings.el;
var holderSettings = renderSettings.holderSettings;
Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (sceneGraph, renderSettings) {
var engineSettings = renderSettings.engineSettings;
var stylesheets = engineSettings.stylesheets;
var stylesheetXml = stylesheets.map(function (stylesheet) {
return '<?xml-stylesheet rel="stylesheet" href="' + stylesheet + '"?>';
Function stagingRenderer
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var stagingRenderer = (function() {
var svg = null,
stagingText = null,
stagingTextNode = null;
return function(graph) {
Function parseURL
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseURL(url, instanceOptions) {
var holder = {
theme: extend(App.settings.themes.gray, null),
stylesheets: instanceOptions.stylesheets,
instanceOptions: instanceOptions
Class Project
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Project < ApplicationRecord
include AASM
include Rails.application.routes.url_helpers
validates :title, :description, :originator, presence: true
Method recommended_projects
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
def recommended_projects(episode = nil)
return [] if keywords.empty?
recommended = []
keywords.each do |word|
- 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 formatProperty
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
Function updateResizableElements
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateResizableElements(element) {
var images;
if (element == null || element.nodeType == null) {
images = App.vars.resizableImages;
} else {
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (function() {
var canvas = DOM.newEl('canvas');
var ctx = null;
return function(sceneGraph) {
Function addTableFilter
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.fn.addTableFilter = function (options) {
var o = $.extend({}, $.fn.addTableFilter.defaults, options),
tgt,
id,
label,