publiclab/image-sequencer

View on GitHub

Showing 206 of 267 total issues

Function UserInterface has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function UserInterface(events = {}) {

  events.onSetup = events.onSetup || function(step) {
    if (step.ui == false) {
      // No UI
Severity: Minor
Found in src/ui/UserInterface.js - About 1 hr to fix

Function draw has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function draw(input, callback) {
    var step = this;

    function output(image, datauri, mimetype, wasmSuccess) {
      step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
Severity: Minor
Found in src/modules/Gradient/Module.js - About 1 hr to fix

Function ImportImageModuleUi has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ImportImageModuleUi(step, ui) {

  function setup(setImage, onLoad) {

    // generate a unique timestamp based id for the dropzone
Severity: Minor
Found in src/modules/ImportImage/Ui.js - About 1 hr to fix

Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(pixels){
  var canvas = document.createElement('canvas');
  canvas.width = pixels.shape[0];
  canvas.height = pixels.shape[1];
  var ctx = canvas.getContext('2d');
Severity: Minor
Found in src/modules/BlobAnalysis/BlobAnalysis.js - About 1 hr 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 doubleThreshold has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, grads, strongEdgePixels, weakEdgePixels, pixelsToBeSupressed) {

  const highThreshold = findMaxInMatrix(grads) * highThresholdRatio, // High Threshold relative to the strongest edge
    lowThreshold = highThreshold * lowThresholdRatio; // Low threshold relative to high threshold

Severity: Minor
Found in src/modules/EdgeDetect/EdgeUtils.js - About 1 hr 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 draw has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function draw(input, callback) {

    var step = this,
      startingX = Number(options.startingX || defaults.startingX),
      startingY = Number(options.startingY || defaults.startingY),
Severity: Minor
Found in src/modules/ConstrainedCrop/Module.js - About 1 hr to fix

Function ImageThreshold has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ImageThreshold(options, UI) {

  var output;

  function draw(input, callback, progressObj) {
Severity: Minor
Found in src/modules/Threshold/Module.js - About 1 hr to fix

Function FlipImage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function FlipImage(options, UI) {
  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
  options.Axis = options.Axis || defaults.Axis;

  let output;
Severity: Minor
Found in src/modules/FlipImage/Module.js - About 1 hr to fix

Function draw has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function draw(input, callback, progressObj) {

    progressObj.stop(true);
    progressObj.overrideFlag = true;

Severity: Minor
Found in src/modules/Contrast/Module.js - About 1 hr to fix

Function Exposure has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Exposure(options, UI) {

  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
  var output;

Severity: Minor
Found in src/modules/Exposure/Module.js - About 1 hr to fix

Function draw has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function draw(input, callback) {

    var step = this;

    if (!options.inBrowser) {
Severity: Minor
Found in src/modules/FisheyeGl/Module.js - About 1 hr to fix

Function BlobAnalysis has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function BlobAnalysis(options, UI){

  var output;
  
  function draw(input, callback, progressObj) {
Severity: Minor
Found in src/modules/BlobAnalysis/Module.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if (!options.inBrowser) {
      require('../_nomodule/gl-context')(input, callback, step, options);
    }
    else {
      // Create a canvas, if it doesn't already exist.
Severity: Critical
Found in src/modules/FisheyeGl/Module.js - About 1 hr to fix

Function DoNothing has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function DoNothing(options, UI) {

  var output;
  var jsQR = require('jsqr');
  var getPixels = require('get-pixels');
Severity: Minor
Found in src/modules/DecodeQr/Module.js - About 1 hr to fix

Function TextOverlay has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function TextOverlay(options, UI) {

  var output;

  function draw(input, callback) {
Severity: Minor
Found in src/modules/TextOverlay/Module.js - About 1 hr to fix

Function updatePreviews has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updatePreviews(src, DomNode) {
  $(DomNode).find('img').remove();

  var previewSequencerSteps = {
    'resize': '125%',
Severity: Minor
Found in examples/lib/insertPreview.js - About 1 hr to fix

Function Brightness has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Brightness(options, UI) {

  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
  var output;

Severity: Minor
Found in src/modules/Brightness/Module.js - About 1 hr to fix

Function ReplaceColor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ReplaceColor(options, UI) {

  var output;

  function draw(input, callback, progressObj) {
Severity: Minor
Found in src/modules/ReplaceColor/Module.js - About 1 hr to fix

Function Gamma has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Gamma(options, UI) {

  var output;

  function draw(input, callback, progressObj) {
Severity: Minor
Found in src/modules/GammaCorrection/Module.js - About 1 hr to fix

Function Convolution has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Convolution(options, UI) {

  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));

  options.kernelValues = options.kernelValues || defaults.kernelValues;
Severity: Minor
Found in src/modules/Convolution/Module.js - About 1 hr to fix
Severity
Category
Status
Source
Language