publiclab/image-sequencer

View on GitHub
examples/lib/defaultHtmlStepUi.js

Summary

Maintainability
F
6 days
Test Coverage

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

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

  function onComplete(step) {
    let {$step, $stepAll} = step;
    $step('img').show();
    $stepAll('.load-spin').hide();
    $step('.load').hide();
Severity: Major
Found in examples/lib/defaultHtmlStepUi.js - About 2 hrs to fix

Avoid deeply nested control flow statements.
Open

            if (inputDesc.type.toLowerCase() == 'range') {
              html +=
                '"min="' +
                inputDesc.min +
                '"max="' +
Severity: Major
Found in examples/lib/defaultHtmlStepUi.js - About 45 mins to fix

There are no issues that match your filters.

Category
Status