publiclab/image-sequencer

View on GitHub

Showing 206 of 267 total issues

Function canvasResize has a Cognitive Complexity of 141 (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/Shadow/Module.js - About 2 days 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 DefaultHtmlStepUi has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
Open

function DefaultHtmlStepUi(_sequencer, options) {
  options = options || {};
  var stepsEl = options.stepsEl || document.querySelector('#steps');
  var selectStepSel = options.selectStepSel = options.selectStepSel || '#selectStep';

Severity: Minor
Found in examples/lib/defaultHtmlStepUi.js - About 2 days 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 ImageSequencer has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
Open

ImageSequencer = function ImageSequencer(options) {

  var str = require('./Strings.js')(this.steps, modulesInfo, addSteps, copy);

  var sequencer = (this.name == 'ImageSequencer') ? this : this.sequencer;
Severity: Minor
Found in src/ImageSequencer.js - About 1 day 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 DefaultHtmlStepUi has 382 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function DefaultHtmlStepUi(_sequencer, options) {
  options = options || {};
  var stepsEl = options.stepsEl || document.querySelector('#steps');
  var selectStepSel = options.selectStepSel = options.selectStepSel || '#selectStep';

Severity: Major
Found in examples/lib/defaultHtmlStepUi.js - About 1 day to fix

Function ImageSequencer has 264 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ImageSequencer = function ImageSequencer(options) {

  var str = require('./Strings.js')(this.steps, modulesInfo, addSteps, copy);

  var sequencer = (this.name == 'ImageSequencer') ? this : this.sequencer;
Severity: Major
Found in src/ImageSequencer.js - About 1 day to fix

Function onSetup has 243 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function onSetup(step, stepOptions) {
    if (step.options && step.options.description)
      step.description = step.options.description;
    
    let stepDocsLink = '';
Severity: Major
Found in examples/lib/defaultHtmlStepUi.js - About 1 day to fix

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

window.onload = function () {
  sequencer = ImageSequencer(); // Set the global sequencer variable
  
  options = {
    sortField: 'text',
Severity: Major
Found in examples/demo.js - About 1 day to fix

Function PixelManipulation has 205 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function PixelManipulation(image, options) {
  // To handle the case where pixelmanipulation is called on the input object itself
  // like input.pixelManipulation(options)

  const isGIF = image.src.includes('image/gif');
Severity: Major
Found in src/modules/_nomodule/PixelManipulation.js - About 1 day to fix

Function Noise has a Cognitive Complexity of 49 (exceeds 5 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: Minor
Found in src/modules/NoiseReduction/NoiseReduction.js - About 7 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 47 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(steps, modulesInfo, addSteps, copy) {
  // Genates a CLI string for the current sequence
  function toCliString() {
    var cliStringSteps = '"', cliOptions = {};
    for (var step in this.steps) {
Severity: Minor
Found in src/Strings.js - About 7 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 formatInput has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

function formatInput(args, format, images) {
  var json_q = {};
  var format_i = format;
  if (format == '+')
    format = ['string_a', 'o_object'];
Severity: Minor
Found in src/FormatInput.js - About 6 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

File defaultHtmlStepUi.js has 397 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Set the UI in sequencer. This Will generate HTML based on
// Image Sequencer events :
// onSetup : Called every time a step is added
// onDraw : Called every time a step starts draw
// onComplete : Called every time a step finishes drawing
Severity: Minor
Found in examples/lib/defaultHtmlStepUi.js - About 5 hrs to fix

Function canvasResize has 128 lines of code (exceeds 25 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: Major
Found in src/modules/Shadow/Module.js - About 5 hrs to fix

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

module.exports = function(steps, modulesInfo, addSteps, copy) {
  // Genates a CLI string for the current sequence
  function toCliString() {
    var cliStringSteps = '"', cliOptions = {};
    for (var step in this.steps) {
Severity: Major
Found in src/Strings.js - About 5 hrs to fix

Function IntermediateHtmlStepUi has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function IntermediateHtmlStepUi(_sequencer, step, options) {
  function stepUI() {
    // Basic markup for the selector
    return '<div class="row insertDiv collapse">\
          <section class="panel panel-primary .insert-step">\
Severity: Major
Found in examples/lib/intermediateHtmlStepUi.js - About 5 hrs to fix

Function DoNothing has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

  var output;
Severity: Major
Found in src/modules/WebglDistort/Module.js - About 4 hrs to fix

Function DoNothing has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

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

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

  var output;
Severity: Minor
Found in src/modules/WebglDistort/Module.js - About 4 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 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function draw(input, callback, progressObj) {

    options.X_value = parseInt(options.X_value || defaults.X_value);
    options.Y_value = parseInt(options.Y_value || defaults.Y_value);

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

Function nonMaxSupress has a Cognitive Complexity of 31 (exceeds 5 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 4 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 Run has a Cognitive Complexity of 31 (exceeds 5 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: Minor
Found in src/Run.js - About 4 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

Severity
Category
Status
Source
Language