packages/miew/src/gfx/geometries/ContactSurface.js
Function ContactSurface
has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring. Open
Open
function ContactSurface(packedArrays, boundaries, params, _indexList) {
// Field generation method adapted from AstexViewer (Mike Hartshorn)
// by Fred Ludlow.
// Other parts based heavily on NGL (Alexander Rose) EDT Surface class
//
- 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 ContactSurface
has 324 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ContactSurface(packedArrays, boundaries, params, _indexList) {
// Field generation method adapted from AstexViewer (Mike Hartshorn)
// by Fred Ludlow.
// Other parts based heavily on NGL (Alexander Rose) EDT Surface class
//
File ContactSurface.js
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import utils from '../../utils'
import { Vector3 } from 'three'
/**
* Modifed from SpatialHash
Function AVHash
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
Open
function AVHash(posRad, min, max, maxDistance) {
const itemSize = 4
const nAtoms = posRad.length / itemSize
const minX = min[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 AVHash
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function AVHash(posRad, min, max, maxDistance) {
const itemSize = 4
const nAtoms = posRad.length / itemSize
const minX = min[0]
Function projectPoints
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function projectPoints() {
// For each atom:
// Iterate over a subsection of the grid, for each point:
// If current value < 0.0, unvisited, set positive
//
Function projectTorus
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function projectTorus(a, b) {
const aIdx = itemSize * a
const bIdx = itemSize * b
const xa = posRad[aIdx]
const ya = posRad[aIdx + 1]
Function withinRadii
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.withinRadii = function (x, y, z, rExtra, out) {
let outIdx = 0
const nearI = hashFunc(x, minX)
const nearJ = hashFunc(y, minY)
Avoid deeply nested control flow statements. Open
Open
if (d2 < ar2) {
const w = Math.exp(-d2 * sigma2Inv)
const cIdx = idx * 3
volTex[cIdx] += cr * w
volTex[cIdx + 1] += cg * w
Avoid deeply nested control flow statements. Open
Open
if (dx * dx + dy * dy + dz * dz <= rSum * rSum) {
out[outIdx++] = data[dataIndex]
}
Avoid deeply nested control flow statements. Open
Open
for (let ix = minx; ix < maxx; ix++) {
dx = px - gridx[ix]
d2 = dzy2 + dx * dx
const idx = ix + zyOffset
const current = grid[idx]
Function obscured
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function obscured(innX, innY, innZ, a, b) {
Function withinRadii
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
this.withinRadii = function (x, y, z, rExtra, out) {