Showing 206 of 267 total issues
Function CropModule
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function CropModule(options, UI) {
// we should get UI to return the image thumbnail so we can attach our own UI extensions
// add our custom in-module html ui:
if (options.step.inBrowser && !options.noUI) var ui = require('./Ui.js')(options.step, UI);
- Read upRead up
- Create a ticketCreate a ticket
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 otsu
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function otsu(histData) {
let total = 0;
for (let t = 0; t < 256; t++) total += histData[t];
let sum = 0;
- Read upRead up
- Create a ticketCreate a ticket
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 Crop
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function Crop(pixels, options, cb) {
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
options.x = options.x || defaults.x;
options.y = options.y || defaults.y;
- Read upRead up
- Create a ticketCreate a ticket
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 Dynamic
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function Dynamic(options, UI) {
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
var output;
// This function is called on every draw.
- Read upRead up
- Create a ticketCreate a ticket
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 exports
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function Rotate(pixels, finalPixels, rotate_value, width, height, cos, sin){
- Create a ticketCreate a ticket
Function doubleThreshold
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, grads, strongEdgePixels, weakEdgePixels, pixelsToBeSupressed) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!((grads[x][y] >= grads[x + 1][y - 1]) && (grads[x][y] >= grads[x - 1][y + 1]))) {
pixelsToBeSupressed.push([x, y]);
}
- Create a ticketCreate a ticket
Function categorizeAngle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function categorizeAngle(angle){
const pi = Math.PI;
angle = angle > 0 ? angle : pi - Math.abs(angle); // Diagonally flip the angle if it is negative (since edge remains the same)
if (angle <= pi / 8 || angle > 7 * pi / 8) return 1;
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
if (pixels.data[curr + channels - 1] === 0) {
const prev = prevIndex + j * channels;
for (let k = 0; k < channels; ++k) {
pixels.data[curr + k] = pixels.data[prev + k];
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (let c = 0; c < channels; c++) {
frames[f].set(x, y, c, pixels.get(f, x, y, c));
}
- Create a ticketCreate a ticket
Function changePixel
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function changePixel(r1, g1, b1, a1, x, y) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (var k = w; k < (w + options.X_value); k++) {
for (var l = 0; l < (h + Math.abs(options.Y_value)); l++) {
let val = (((k - w) / options.X_value) * 255);
pixelSetter(k, l, [val, val, val, 255], newPixels);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (index < 0) index += size + 1;
- Create a ticketCreate a ticket
Function Threshold
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function Threshold(pixels, options, histData) {
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
type = options.threshold || defaults.threshold;
threshold = parseInt(options.input) || defaults.input;
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
if (!((grads[x][y] >= grads[x + 1][y + 1]) && (grads[x][y] >= grads[x - 1][y - 1]))){
pixelsToBeSupressed.push([x, y]);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (var l = h; l < (h + options.Y_value); l++) {
let val = ((l - h) / options.Y_value * 255);
pixelSetter(k, l, [val, val, val, 255], newPixels);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (var k = 0; k < (w + options.X_value); k++) {
for (var l = 0; l < Math.abs(options.Y_value); l++) {
if (l >= ((options.X_value / Math.abs(options.Y_value)) * (w + options.X_value - k)) && k >= w) {
continue;
}
- Create a ticketCreate a ticket
Function DoNothing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function DoNothing(options, UI) {
var output;
var gl = require('fisheyegl');
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
for (let i = 0; i < iMax && i < w; i++) {
for (let j = 0; j < jMax && j < h; j++) {
let x = i, y = j + Math.abs(options.Y_value);
pixelSetter(x, y, [pixels.get(i, j, 0), pixels.get(i, j, 1), pixels.get(i, j, 2), pixels.get(i, j, 3)], newPixels);
}
- Create a ticketCreate a ticket
Function changePixel
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function changePixel(r2, g2, b2, a2, x, y) {
- Create a ticketCreate a ticket