publiclab/image-sequencer

View on GitHub

Showing 267 of 267 total issues

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      return require('../_nomodule/PixelManipulation.js')(input, {
        output: output,
        ui: options.step.ui,
        changePixel: changePixel,
        format: input.format,
Severity: Major
Found in src/modules/Blend/Module.js and 1 other location - About 2 hrs to fix
src/modules/Mask/Module.js on lines 61..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          return require('../_nomodule/PixelManipulation.js')(input, {
            output: output,
            ui: options.step.ui,
            changePixel: changePixel,
            format: input.format,
Severity: Major
Found in src/modules/Mask/Module.js and 1 other location - About 2 hrs to fix
src/modules/Blend/Module.js on lines 113..122

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            [
              qrPixels.get(x - xe, y - ye, 0),
              qrPixels.get(x - xe, y - ye, 1),
              qrPixels.get(x - xe, y - ye, 2),
              qrPixels.get(x - xe, y - ye, 3)
Severity: Major
Found in src/modules/AddQR/QR.js and 1 other location - About 2 hrs to fix
src/modules/Dynamic/Module.js on lines 49..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      return [
        pixels.get(curX + distX, curY + distY, 0),
        pixels.get(curX + distX, curY + distY, 1),
        pixels.get(curX + distX, curY + distY, 2),
        pixels.get(curX + distX, curY + distY, 3)
Severity: Major
Found in src/modules/Dynamic/Module.js and 1 other location - About 2 hrs to fix
src/modules/AddQR/QR.js on lines 23..28

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  for (let i = 0; i <= imageDataLength; i++) {
    pixels.data[i] = Math.floor(lumR[pixels.data[i++]] + lumG[pixels.data[i++]] + lumB[pixels.data[i++]]);
  }
Severity: Major
Found in src/modules/Dither/Dither.js and 1 other location - About 2 hrs to fix
src/modules/Threshold/Threshold.js on lines 16..18

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 77.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  for (var i = 0; i <= imageDataLength; i++) {
    pixels.data[i] = Math.floor(lumR[pixels.data[i++]] + lumG[pixels.data[i++]] + lumB[pixels.data[i++]]);
  }
Severity: Major
Found in src/modules/Threshold/Threshold.js and 1 other location - About 2 hrs to fix
src/modules/Dither/Dither.js on lines 22..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 77.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language