publiclab/image-sequencer

View on GitHub

Showing 206 of 267 total issues

Function Run has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Run(ref, json_q, callback, ind, progressObj) {
  if (!progressObj) progressObj = { stop: function() { } };

  function drawStep(drawarray, pos) {
    if (pos == drawarray.length && drawarray[pos - 1] !== undefined) {
Severity: Major
Found in src/Run.js - About 2 hrs to fix

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

  function draw(input, callback, progressObj) {

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

Severity: Major
Found in src/modules/Dynamic/Module.js - About 2 hrs to fix

Function Rotate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  let output;

  function draw(input, callback, progressObj) {
Severity: Major
Found in src/modules/Rotate/Module.js - About 2 hrs to fix

Function DefaultHtmlSequencerUi has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function DefaultHtmlSequencerUi(_sequencer, options) {

  options = options || {};
  var addStepSel = options.addStepSel = options.addStepSel || '#addStep';
  var removeStepSel = options.removeStepSel = options.removeStepSel || 'button.remove';
Severity: Minor
Found in examples/lib/defaultHtmlSequencerUi.js - About 2 hrs 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 LoadImage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function LoadImage(ref, name, src, main_callback) {
  function makeImage(datauri) {
    var image = {
      src: datauri,
      format: datauri.split(':')[1].split(';')[0].split('/')[1]
Severity: Minor
Found in src/ui/LoadImage.js - About 2 hrs 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 exports has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (program, sequencer, outputFilename) {
  utils.makedir(program.output, () => {
    console.log('Files will be exported to "' + program.output + '"');

    if (program.basic)
Severity: Minor
Found in src/cli/sequencerSteps.js - About 2 hrs 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 CropModuleUi has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  let inputWidth = 0,
    inputHeight = 0;

Severity: Major
Found in src/modules/Crop/Ui.js - About 2 hrs to fix

Function onComplete has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function onComplete(step) {
    let {$step, $stepAll} = step;
    $step('img').show();
    $stepAll('.load-spin').hide();
    $step('.load').hide();
Severity: Major
Found in examples/lib/defaultHtmlStepUi.js - About 2 hrs to fix

Function exports has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (program, sequencer, outputFilename) {
  utils.makedir(program.output, () => {
    console.log('Files will be exported to "' + program.output + '"');

    if (program.basic)
Severity: Major
Found in src/cli/sequencerSteps.js - About 2 hrs to fix

Function Noise has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Noise(pixels, method) {
  let neighbourX = [-1, -1, -1, 0, 0, 0, 1, 1, 1];
  let neighbourY = [-1, 0, 1, -1, 0, 1, -1, 0, 1];

  if(method == 'Median Filtering'){
Severity: Major
Found in src/modules/NoiseReduction/NoiseReduction.js - About 2 hrs to fix

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

  function draw(input, callback, progressObj) {

    options.offset = parseInt(options.offset || defaults.offset);

    progressObj.stop(true);
Severity: Major
Found in src/modules/Overlay/Module.js - About 2 hrs to fix

Function Mask has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Major
Found in src/modules/Mask/Module.js - About 2 hrs to fix

Function warpWebGl has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var warpWebGl = function warpWebGl(id, matrix1, matrix2, download) {

    // try to create a WebGL canvas (will fail if WebGL isn't supported)
    try {
      var canvas = fx.canvas(1500, 1500);
Severity: Major
Found in src/modules/WebglDistort/Module.js - About 2 hrs to fix

Function Channel has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  var output;

  function draw(input, callback, progressObj) {
Severity: Major
Found in src/modules/Histogram/Module.js - About 2 hrs to fix

File ImageSequencer.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

if (typeof window !== 'undefined') { isBrowser = true; }
else { var isBrowser = false; }
require('./util/getStep.js');

/**
Severity: Minor
Found in src/ImageSequencer.js - About 2 hrs to fix

Function Rotate has 61 lines of code (exceeds 25 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: Major
Found in src/modules/Rotate/Rotate.js - About 2 hrs to fix

Function UserInterface has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 ColorTemperature has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ColorTemperature(options, UI) {
  
  const pixelSetter = require('../../util/pixelSetter.js');
  var defaults = require('./../../util/getDefaults.js')(require('./info.json'));

Severity: Major
Found in src/modules/ColorTemperature/Module.js - About 2 hrs to fix

Function stepUI has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function stepUI() {
    // Basic markup for the selector
    return '<div class="row insertDiv collapse">\
          <section class="panel panel-primary .insert-step">\
            <button class="btn btn-default close-insert-box"><i class="fa fa-times" aria-hidden="true"></i> Close</button>\
Severity: Major
Found in examples/lib/intermediateHtmlStepUi.js - About 2 hrs to fix

Function runVideo has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function runVideo(){
      /* event handler for Take-Photo */
      document.getElementById('video').style.display = 'inline';
      document.getElementById('capture').style.display = 'inline';
      document.getElementById('close').style.display = 'inline';
Severity: Major
Found in src/ui/SetInputStep.js - About 2 hrs to fix
Severity
Category
Status
Source
Language