Showing 451 of 1,081 total issues
Method call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(image_file, entry:)
{
default: {
desktop: image_file.ready? ? image_file.attachment.url(desktop_style(entry)) : '',
mobile: image_file.ready? ? image_file.attachment.url(:medium) : ''
- 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 allocatePlayer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
allocatePlayer({
playerType, playerId, playsInline, mediaEventsContextData,
hooks, poster, loop = false, controls = false, altText,
onRelease
}) {
- 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 navigation_bar_css_class
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def navigation_bar_css_class(entry, options = {})
[
options[:class],
entry.home_button.enabled? ? 'with_home_button' : nil,
entry.overview_button.enabled? ? 'with_overview_button' : 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 build_folder_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_folder_list(folders)
ul(class: 'folders') do
folders.each do |folder|
li('data-id' => folder.id) do
text_node(link_to_folder(folder))
- 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 (((index === 0 || index >= 6) && position[0] > startPoints[0][0]) ||
(index >= 2 && index <= 4 && position[0] < startPoints[0][0])) {
index = (10 - index) % 8;
}
Consider simplifying this complex logical expression. Open
if ((index >= 0 && index <= 3 && position[1] > startPoints[0][1]) ||
(index >= 4 && index <= 6 && position[1] < startPoints[0][1])){
index = 6 - index;
}
Consider simplifying this complex logical expression. Open
if (!(at === 'before' && !range && sibling === after) &&
!(at === 'after' && !range && sibling === before)) {
sourceBatch.remove(contentElement);
if (at === 'before') {
Consider simplifying this complex logical expression. Open
if (deleteCharacter(editor, node, path, /\n\n/) ||
deleteCharacter(editor, node, path, new RegExp(`^\n`)) ||
deleteCharacter(editor, node, path, new RegExp(`${shy}\\s`)) ||
deleteCharacter(editor, node, path, new RegExp(`^${shy}`)) ||
deleteCharacter(editor, node, path, new RegExp(`\\s${shy}`), 1) ||
Consider simplifying this complex logical expression. Open
if (backdrop.color ||
(backdrop.image && backdrop.image.toString().startsWith('#'))) {
return {
type: 'color',
color: backdrop.color || backdrop.image
Consider simplifying this complex logical expression. Open
if (lastPosition.current &&
position &&
(lastPosition.current.top !== position.top ||
lastPosition.current.left !== position.left ||
lastPosition.current.width !== position.width ||
Consider simplifying this complex logical expression. Open
else if (section.backdrop?.color ||
(section.backdrop?.image && section.backdrop.image.toString().startsWith('#'))) {
return {
color: section.backdrop.color || section.backdrop.image
}
Function initPlayer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function initPlayer(player, getPlayerState, playerActions, prevFileId, fileId) {
Function className
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function className(isSectionSelected, transitionSelection, isHighlighted, isBackdropElementSelected, transitions) {
Function renderChapters
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function renderChapters(entryStructure,
currentSectionIndex,
setCurrentSection,
scrollTargetSectionIndex,
setScrollTargetSectionIndex) {
Function useScrollPosition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function useScrollPosition(effect, deps, element, useWindow, wait) {
Function getMotifAreaPadding
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
contentRequiresPadding, transitions, motifAreaDimension, backdropContentElement, empty
Function deleteCharacter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function deleteCharacter(editor, node, path, regExp, offset = 0) {
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(entry, template, configuration, property_base_name, options)
Function fadeSound
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
fadeSound: function(media, endVolume, fadeTime) {
var fadeResolution = 10;
var startVolume = media.volume();
var steps = fadeTime / fadeResolution;
var leap = (endVolume - startVolume) / steps;
- 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 History
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const History = function(slideshow, adapter) {
slideshow.on('slideshowchangepage', function(event, options) {
var hash = slideshow.currentPage().attr('id');
if (options.back) {
- 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"