publiclab/image-sequencer

View on GitHub

Showing 206 of 267 total issues

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

  function draw(input, callback, progressObj) {
    progressObj.stop(true);
    progressObj.overrideFlag = true;

    var step = this;
Severity: Major
Found in src/modules/MinifyImage/Module.js - About 2 hrs to fix

Function flipImage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function flipImage(oldPixels, pixels, axis) {
  const pixelSetter = require('../../util/pixelSetter.js');

  var width = oldPixels.shape[0],
    height = oldPixels.shape[1];
Severity: Minor
Found in src/modules/FlipImage/flipImage.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 InsertStep has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function InsertStep(ref, index, name, o) {
  if (ref.sequences[name]) {
    return ref.importJSON(ref.sequences[name]);
  }

Severity: Minor
Found in src/InsertStep.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 draw has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function draw(input, callback, progressObj) {

    const defaults = require('./../../util/getDefaults.js')(require('./info.json'));
    options.rotate = options.rotate || defaults.rotate;

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

Function CImage has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function CImage(src, step, callback) {
    var datauri;
    if (src.match(/^data:/i)) {
      datauri = src;
      callback(datauri, step);
Severity: Major
Found in src/ui/LoadImage.js - About 2 hrs to fix

Function Crop has 53 lines of code (exceeds 25 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;

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

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

  function draw(input, callback, progressObj) {

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

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

Function Dither has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function Dither(pixels, type) {
  type = type;
  let bayerThresholdMap = [
    [15, 135, 45, 165],
    [195, 75, 225, 105],
Severity: Major
Found in src/modules/Dither/Dither.js - About 2 hrs to fix

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

File demo.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var defaultHtmlSequencerUi = require('./lib/defaultHtmlSequencerUi.js'),
  setupCache = require('./lib/cache.js'),
  intermediateHtmlStepUi = require('./lib/intermediateHtmlStepUi.js'),
  DefaultHtmlStepUi = require('./lib/defaultHtmlStepUi.js'),
  urlHash = require('./lib/urlHash.js'),
Severity: Minor
Found in examples/demo.js - About 2 hrs to fix

Function onload has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    image.onload = function() {

      var texture = canvas.texture(image);

      // var bbox1 = {
Severity: Major
Found in src/modules/WebglDistort/Module.js - About 2 hrs to fix

Function Average has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  var output;

  options.step.metadata = options.step.metadata || {};
Severity: Major
Found in src/modules/Average/Module.js - About 2 hrs to fix

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

  function draw(input, callback, progressObj) {
    progressObj.stop(true);
    progressObj.overrideFlag = true;

    var step = this;
Severity: Minor
Found in src/modules/Mask/Module.js - About 2 hrs to fix

Function AddQR has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

  function draw(input, callback, progressObj) {

    options.temperature = options.temperature || defaults.temperature;
    options.temperature = (options.temperature > 40000) ? 40000 : options.temperature;
    options.temperature = (options.temperature < 0) ? 0 : options.temperature;
Severity: Minor
Found in src/modules/ColorTemperature/Module.js - About 1 hr to fix

Function InsertStep has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function InsertStep(ref, index, name, o) {
  if (ref.sequences[name]) {
    return ref.importJSON(ref.sequences[name]);
  }

Severity: Minor
Found in src/InsertStep.js - About 1 hr to fix

Function ColorHalftone has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

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

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

  var output;
Severity: Minor
Found in src/modules/ColorHalftone/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 Gradient has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

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

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

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

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