Showing 10 of 13 total issues
Function smooth
has a Cognitive Complexity of 217 (exceeds 5 allowed). Consider refactoring. Open
Open
const smooth = (function () {
// Scroll Variables (tweakable)
var defaultOptions = {
// Scrolling Core
frameRate: 150, // [Hz]
- 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 smooth
has 503 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const smooth = (function () {
// Scroll Variables (tweakable)
var defaultOptions = {
// Scrolling Core
frameRate: 150, // [Hz]
File Smooth.js
has 506 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable getter-return */
/* eslint-disable no-empty */
/* eslint-disable @typescript-eslint/no-unused-vars */
const smooth = (function () {
// Scroll Variables (tweakable)
Function scrollArray
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function scrollArray(elem, left, top) {
directionCheck(left, top);
if (options.accelerationMax != 1) {
var now = Date.now();
Function keydown
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function keydown(event) {
var target = event.target;
var modifier = event.ctrlKey || event.altKey || event.metaKey || (event.shiftKey && event.keyCode !== key.spacebar);
// our own tracked active element could've been removed from the DOM
Function wheel
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function wheel(event) {
if (!initDone) {
init();
}
Function init
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init() {
if (initDone || !document.body) return;
initDone = true;
Function step
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var step = function (time) {
var now = Date.now();
var scrollX = 0;
var scrollY = 0;
Consider simplifying this complex logical expression. Open
Open
if (
event.defaultPrevented ||
inputNodeNames.test(target.nodeName) ||
(isNodeName(target, 'input') && !buttonTypes.test(target.type)) ||
isNodeName(activeElement, 'video') ||
Avoid too many return
statements within this function. Open
Open
return true;