Showing 82 of 82 total issues
Function set
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function set(name, value) {
if (!uniforms[name]) {
// console.warn('No uniform property with name ', name);
return;
}
Similar blocks of code found in 3 locations. Consider refactoring. Open
} else if (storage === 'halfFloat') {
internalFormat = {
1: gl.R16F,
2: gl.RG16F,
3: gl.RGB16F,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
} else if (storage === 'float' || (!storage && isFloatArray)) {
internalFormat = {
1: gl.R32F,
2: gl.RG32F,
3: gl.RGB32F,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
} else if (storage === 'snorm') {
internalFormat = {
1: gl.R8_SNORM,
2: gl.RG8_SNORM,
3: gl.RGB8_SNORM,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function initWebGL
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initWebGL(envMapLDR, model) {
unloadRenderer(renderer);
renderer = new THREE.WebGLRenderer({
antialias: true
});
Function envMapDistribution
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function envMapDistribution(image) {
const data = image.data;
const cdfImage = {
width: image.width + 2,
Function makePrimitiveInfo
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makePrimitiveInfo(geometry) {
const primitiveInfo = [];
const indices = geometry.getIndex().array;
const position = geometry.getAttribute('position');
const materialMeshIndex = geometry.getAttribute('materialMeshIndex');
Function partition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function partition(array, compare, left = 0, right = array.length) {
while (left !== right) {
while (compare(array[left])) {
left++;
if (left === right) {
- 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 getTextureFormat
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getTextureFormat(gl, channels, storage, data, gammaCorrection) {
let type;
let internalFormat;
const isByteArray =
- 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 addLightAtCoordinates
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function addLightAtCoordinates(light, image, originCoords) {
const floatBuffer = image.data;
const width = image.width;
const height = image.height;
const xTexels = floatBuffer.length / (3 * height);
- 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 addLightAtCoordinates
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addLightAtCoordinates(light, image, originCoords) {
const floatBuffer = image.data;
const width = image.width;
const height = image.height;
const xTexels = floatBuffer.length / (3 * height);
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function init() {
const [envMap, envMapLDR, gltf] = await Promise.all([
load(THREE.RGBELoader, '../envmaps/street-by-water.hdr'),
load(THREE.TextureLoader, 'envmap.jpg'),
load(THREE.GLTFLoader, 'scene.gltf'),
Function mergeGeometry
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeGeometry(geometryAndMaterialIndex, vertexCount, indexCount) {
const positionAttrib = new BufferAttribute(new Float32Array(3 * vertexCount), 3, false);
const normalAttrib = new BufferAttribute(new Float32Array(3 * vertexCount), 3, false);
const uvAttrib = new BufferAttribute(new Float32Array(2 * vertexCount), 2, false);
const materialMeshIndexAttrib = new BufferAttribute(new Int32Array(2 * vertexCount), 2, false);
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.render = (scene, camera) => {
if (!module.renderWhenOffFocus) {
const hasFocus = document.hasFocus();
if (!hasFocus) {
lastFocus = hasFocus;
Function drawFull
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawFull(camera) {
if (!ready) {
return;
}
Function initFrameBuffers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initFrameBuffers(width, height) {
const makeHdrBuffer = () => makeFramebuffer(gl, {
color: { 0: makeTexture(gl, { width, height, storage: 'float', magFilter: gl.LINEAR, minFilter: gl.LINEAR }) }
});
Function makeMaterialBuffer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function makeMaterialBuffer(gl, materials) {
const maps = getTexturesFromMaterials(materials, ['map', 'normalMap']);
const pbrMap = mergeTexturesFromMaterials(materials, ['roughnessMap', 'metalnessMap']);
const textures = {};
- 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 flattenBvh
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function flattenBvh(bvh) {
const flat = [];
const isBounds = [];
const splitAxisMap = {
- 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 makeStratifiedSampler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function makeStratifiedSampler(strataCount, dimensions) {
const strata = [];
const l = strataCount ** dimensions;
for (let i = 0; i < l; i++) {
strata[i] = i;
Function init
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function init() {
window.addEventListener('resize', resize);
resize();
selectEnvMapFromName(INITIAL_ENV_MAP.name);