hoverinc/ray-tracing-renderer

View on GitHub

Showing 82 of 82 total issues

Function nthElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function nthElement(array, compare, left = 0, right = array.length, k = Math.floor((left + right) / 2)) {
  for (let i = left; i <= k; i++) {
    let minIndex = i;
    let minValue = array[i];
    for (let j = i + 1; j < right; j++) {
Severity: Minor
Found in src/renderer/bvhUtil.js - About 25 mins to fix

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 envMapDistribution has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function envMapDistribution(image) {
  const data = image.data;

  const cdfImage = {
    width: image.width + 2,
Severity: Minor
Found in src/renderer/envMapDistribution.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language