Showing 28 of 45 total issues
Avoid deeply nested control flow statements. Open
if (Math.abs(panelDom.translateX) > currPageTranslateStart) {
const panelReturnDis = panelTranslateX
if (Math.abs(panelReturnDis) < currPageTranslateStart) {
panelDom.translateX = -currPageTranslateStart
} else {
Avoid deeply nested control flow statements. Open
if (Math.abs(panelDom.translateX) < currPageTranslateStart) {
const panelReturnDis = panelTranslateX
if (Math.abs(panelReturnDis) > currPageTranslateStart) {
panelDom.translateX = -currPageTranslateStart
} else {
Function Matrix3D
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var Matrix3D = function (n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
this.elements = window.Float32Array ? new Float32Array(16) : []
var te = this.elements
te[0] = (n11 !== undefined) ? n11 : 1; te[4] = n12 || 0; te[8] = n13 || 0; te[12] = n14 || 0
te[1] = n21 || 0; te[5] = (n22 !== undefined) ? n22 : 1; te[9] = n23 || 0; te[13] = n24 || 0
- 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 getImgDomTopY
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getImgDomTopY (dom) {
if (!dom) return 0
const { translateY } = dom
const box = dom.getBoundingClientRect()
const topY = (window.innerHeight - box.height) / 2 + translateY
- 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 getImgDomLeftX
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getImgDomLeftX (dom) {
if (!dom) return 0
const { translateX } = dom
const box = dom.getBoundingClientRect()
const leftX = (window.innerWidth - box.width) / 2 + translateX
- 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
return topY
Avoid too many return
statements within this function. Open
return leftX
Function appendSingleViewer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const appendSingleViewer = () => {
const {
imgObj,
options: {
errorPlh,
- 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"