publiclab/image-sequencer

View on GitHub

Showing 206 of 267 total issues

Function ReplaceImage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ReplaceImage(ref, selector, steps, options) {
  if(!ref.options.inBrowser) return false; // This isn't for Node.js
  var tempSequencer = ImageSequencer({ui: false});
  var this_ = ref;
  if (window.hasOwnProperty('$')) var input = $(selector);
Severity: Minor
Found in src/ReplaceImage.js - About 1 hr to fix

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

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

  var output;

  var gl = require('fisheyegl');
Severity: Minor
Found in src/modules/FisheyeGl/Module.js - About 1 hr to fix

Function canvasResize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

Function convolve has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const convolve = (arrays, kernel, options = {}) => {
  const pipeMode = options.pipeMode || false,
    mode = options.mode || 'gpu';

  const gpu = new GPU(mode != 'gpu' ? {mode} : {});
Severity: Minor
Found in src/modules/_nomodule/gpuUtils.js - About 1 hr to fix

Function Balance has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

  options.red = options.red || defaults.red;
Severity: Minor
Found in src/modules/WhiteBalance/Module.js - About 1 hr to fix

Function draw has 41 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/Average/Module.js - About 1 hr to fix

Function Ndvi has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI);

  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
Severity: Minor
Found in src/modules/Ndvi/Module.js - About 1 hr to fix

Function ExportBin has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ExportBin(dir = './output/', ref, basic, filename) {

  // If user did not give an output filename so we can continue without doing anything
  dir = (dir[dir.length - 1] == '/') ? dir : dir + '/';
  if (ref.options.inBrowser) return false;
Severity: Minor
Found in src/ExportBin.js - About 1 hr to fix

Function ReplaceImage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function ReplaceImage(ref, selector, steps, options) {
  if(!ref.options.inBrowser) return false; // This isn't for Node.js
  var tempSequencer = ImageSequencer({ui: false});
  var this_ = ref;
  if (window.hasOwnProperty('$')) var input = $(selector);
Severity: Minor
Found in src/ReplaceImage.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 Rotate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function Rotate(pixels, finalPixels, rotate_value, width, height, cos, sin){
  const height_half = Math.floor(height / 2),
    width_half = Math.floor(width / 2);
  dimension = width + height;

Severity: Minor
Found in src/modules/Rotate/Rotate.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 MinifyImage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function MinifyImage(options, UI) {
  var output;
  if (!options.inBrowser) {
    base64Img = require('base64-img');
    imagemin = require('imagemin');
Severity: Minor
Found in src/modules/MinifyImage/Module.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 generateOutput has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function generateOutput() {
      if (!(renderableFrames < numFrames) && !(resolvedFrames < numFrames)) {

        if (isGIF) {
          const dataPromises = []; // Array of all DataURI promises
Severity: Minor
Found in src/modules/_nomodule/PixelManipulation.js - About 1 hr to fix

Function drawStep has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function drawStep(drawarray, pos) {
    if (pos == drawarray.length && drawarray[pos - 1] !== undefined) {
      if (ref.objTypeOf(callback) == 'Function' && ref.steps.slice(-1)[0].output) {
        var steps = ref.steps;
        var out = steps[steps.length - 1].output.src;
Severity: Minor
Found in src/Run.js - About 1 hr to fix

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

  function draw(input, callback, progressObj) {

    options.size = Number(options.size || defaults.size);
    options.qrCodeString = options.qrCodeString || defaults.qrCodeString;
    options.startingX = options.startingX || defaults.startingX;
Severity: Minor
Found in src/modules/AddQR/Module.js - About 1 hr to fix

Function edgeDetect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
  options.blur = options.blur || defaults.blur;
  options.highThresholdRatio = options.highThresholdRatio || defaults.highThresholdRatio;
Severity: Minor
Found in src/modules/EdgeDetect/Module.js - About 1 hr to fix

Function insertStep has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function insertStep(index, name, o_) {
    if (ref.modules[name]) var moduleInfo = ref.modules[name][1];
    else {
      console.log('Module ' + name + ' not found.');
    }
Severity: Minor
Found in src/InsertStep.js - About 1 hr to fix

Function nodejsGIFShot has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function nodejsGIFShot(options, cb) {
  const puppeteer = eval('require')('puppeteer');
  puppeteer.launch(
    {
      headless: true,
Severity: Minor
Found in src/modules/_nomodule/node-gifshot.js - About 1 hr to fix

Function Saturation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

Function CropModule has 36 lines of code (exceeds 25 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);
Severity: Minor
Found in src/modules/Crop/Module.js - About 1 hr to fix

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
Severity
Category
Status
Source
Language