publiclab/image-sequencer

View on GitHub

Showing 267 of 267 total issues

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

  for (var i = 0; i < 256; i++) {
    lumR[i] = i * 0.299;
    lumG[i] = i * 0.587;
    lumB[i] = i * 0.114;
  }
Severity: Major
Found in src/modules/Threshold/Threshold.js and 1 other location - About 1 hr to fix
src/modules/Dither/Dither.js on lines 13..17

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 68.

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

  for (let i = 0; i < 256; i++) {
    lumR[i] = i * 0.299;
    lumG[i] = i * 0.587;
    lumB[i] = i * 0.114;
  }
Severity: Major
Found in src/modules/Dither/Dither.js and 1 other location - About 1 hr to fix
src/modules/Threshold/Threshold.js on lines 9..13

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 68.

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 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 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 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 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

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

            fetch('../../../dist/manipulation.wasm').then(response =>
              response.arrayBuffer()
            ).then(bytes =>
              WebAssembly.instantiate(bytes, imports)
            ).then(results => {
Severity: Major
Found in src/modules/_nomodule/PixelManipulation.js and 1 other location - About 1 hr to fix
src/modules/_nomodule/PixelManipulation.js on lines 259..265

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 64.

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

              WebAssembly.instantiate(buf, imports).then(results => {
                results.instance.exports.manipulatePixel(framePix.shape[0], framePix.shape[1], inBrowser, test);
                
                wasmSuccess = true;
                resolvedFrames++;
Severity: Major
Found in src/modules/_nomodule/PixelManipulation.js and 1 other location - About 1 hr to fix
src/modules/_nomodule/PixelManipulation.js on lines 235..245

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 64.

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 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 Tint has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

  var output;
Severity: Minor
Found in src/modules/Tint/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
Severity
Category
Status
Source
Language