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 m in modulesInfo) {
      if (modulesInfo[m] && modulesInfo[m].name)
        addStepSelect.append(
          '<option value="' + m + '">' + modulesInfo[m].name + '</option>'
        );
Severity: Major
Found in examples/demo.js and 1 other location - About 1 hr to fix
examples/lib/intermediateHtmlStepUi.js on lines 131..136

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

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

  function copyPixel(x1, y1, x2, y2){
    pixelSetter(x1, y1, [oldPixels.get(x2, y2, 0), oldPixels.get(x2, y2, 1), oldPixels.get(x2, y2, 2), oldPixels.get(x2, y2, 3)], pixels);
    
  }
Severity: Major
Found in src/modules/FlipImage/flipImage.js and 1 other location - About 1 hr to fix
src/modules/TextOverlay/TextOverlay.js on lines 34..46

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

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 y = 0; y < pixels.shape[1]; y++) {
          pixelSetter(
            x,
            y,
            [
Severity: Major
Found in src/modules/TextOverlay/TextOverlay.js and 1 other location - About 1 hr to fix
src/modules/FlipImage/flipImage.js on lines 7..10

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

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 (var m in modulesInfo) {
      if (modulesInfo[m] && modulesInfo[m].name)
        insertStepSelect.append(
          '<option value="' + m + '">' + modulesInfo[m].name + '</option>'
        );
Severity: Major
Found in examples/lib/intermediateHtmlStepUi.js and 1 other location - About 1 hr to fix
examples/demo.js on lines 55..60

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

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

  var colorHalftone = function colorHalftone(id, options, download) {

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

Function runInBrowserContext has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function runInBrowserContext(input, callback, step, options) {

  // to ignore this from getting browserified
  const puppeteer = eval('require')('puppeteer');

Severity: Minor
Found in src/modules/_nomodule/gl-context.js - About 1 hr to fix

Function replaceImage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function replaceImage (img, steps) {
    var url = img.src;
    // refactor to filetypeFromUrl()
    var ext = url.split('?')[0].split('.').pop();

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

Function nonMaxSupress has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function nonMaxSupress(pixels, grads, angles, pixelsToBeSupressed) {
  for (let x = 0; x < pixels.shape[0]; x++) {
    for (let y = 0; y < pixels.shape[1]; y++) {

      let angleCategory = categorizeAngle(angles[x][y]);
Severity: Minor
Found in src/modules/EdgeDetect/EdgeUtils.js - About 1 hr to fix

Function PaintBucket has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  var output;

  function draw(input, callback, progressObj) {
Severity: Minor
Found in src/modules/PaintBucket/Module.js - About 1 hr to fix

Function onCallback has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      internalSequencer.run(function onCallback(internalOutput) {

        getPixels(internalOutput, function(err, pixels) {
          options.firstImagePixels = pixels;

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

Function mapHtmlTypes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mapHtmlTypes(inputInfo){
  var htmlType;
  switch(inputInfo.type.toLowerCase()){
  case 'integer':
    htmlType = inputInfo.min != undefined ? 'range' : 'number';
Severity: Minor
Found in examples/lib/mapHtmltypes.js - About 1 hr to fix

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

Function GridOverlay has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  var output;

  function draw(input, callback, progressObj) {
Severity: Minor
Found in src/modules/GridOverlay/Module.js - About 1 hr to fix

Function extraManipulation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function extraManipulation(pixels) {

      let temp = parseInt(options.temperature);
      temp /= 100;

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

Function setup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function setup() {
    let x = 0,
      y = 0;

    // display original uncropped input image on initial setup
Severity: Minor
Found in src/modules/Crop/Ui.js - About 1 hr to fix

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

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

  case 'float':
    htmlType = inputInfo.min != undefined ? 'range' : 'text';
    if (htmlType === 'range') inputInfo.step = inputInfo.step || 0.1; // default range step size for float
    break;
Severity: Major
Found in examples/lib/mapHtmltypes.js and 1 other location - About 1 hr to fix
examples/lib/mapHtmltypes.js on lines 8..11

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

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

  case 'integer':
    htmlType = inputInfo.min != undefined ? 'range' : 'number';
    if (htmlType === 'range') inputInfo.step = inputInfo.step || 1; // default range step size for integer
    break;
Severity: Major
Found in examples/lib/mapHtmltypes.js and 1 other location - About 1 hr to fix
examples/lib/mapHtmltypes.js on lines 21..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 57.

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 Average has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

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

  var output;

  options.step.metadata = options.step.metadata || {};
Severity: Minor
Found in src/modules/Average/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 canvasResize has a Cognitive Complexity of 10 (exceeds 5 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

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

Severity
Category
Status
Source
Language