shipshapecode/shepherd

View on GitHub

Showing 5 of 7 total issues

Function getPopperOptions has 35 lines of code (exceeds 30 allowed). Consider refactoring.
Open

export function getPopperOptions(attachToOptions, step) {
  let popperOptions = {
    modifiers: [
      {
        name: 'preventOverflow',
Severity: Minor
Found in src/js/utils/general.js - About 1 hr to fix

    Function _getCenteredStylePopperModifier has 35 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

    function _getCenteredStylePopperModifier() {
      return [
        {
          name: 'applyStyles',
          fn({ state }) {
    Severity: Minor
    Found in src/js/utils/popper-options.js - About 1 hr to fix

      Function _done has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        _done(event) {
          const index = this.steps.indexOf(this.currentStep);
          if (Array.isArray(this.steps)) {
            this.steps.forEach((step) => step.destroy());
          }
      Severity: Minor
      Found in src/js/tour.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 bindAdvance has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function bindAdvance(step) {
        // An empty selector matches the step element
        const { event, selector } = step.options.advanceOn || {};
        if (event) {
          const handler = _setupAdvanceOnHandler(selector, step);
      Severity: Minor
      Found in src/js/utils/bind.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 parseAttachTo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function parseAttachTo(step) {
        const options = step.options.attachTo || {};
        const returnOpts = Object.assign({}, options);
      
        if (isString(options.element)) {
      Severity: Minor
      Found in src/js/utils/general.js - About 25 mins 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