gilbarbara/react-joyride

View on GitHub

Showing 15 of 17 total issues

Function createStore has 190 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export default function createStore(props: StoreState): StoreInstance {
  const store: Map<string, any> = new Map();
  const data: Map<string, any> = new Map();

  class Store {
Severity: Major
Found in src/modules/store.js - About 6 hrs to fix

Function getStyles has 147 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export default function getStyles(stepStyles = {}) {
  const options = deepmerge(defaultOptions, stepStyles.options || {});
  let width = 290;

  if (window.innerWidth > 480) {
Severity: Major
Found in src/styles.js - About 4 hrs to fix

Function componentDidUpdate has 111 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  componentDidUpdate(prevProps, prevState) {
    if (!canUseDOM) return;

    const { action, controlled, index, lifecycle, status } = this.state;
    const { debug, run, stepIndex, steps } = this.props;
Severity: Major
Found in src/components/index.js - About 3 hrs to fix

Function componentDidUpdate has 97 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  componentDidUpdate(prevProps) {
    const {
      action,
      callback,
      continuous,
Severity: Major
Found in src/components/Step.js - About 2 hrs to fix

Function render has 91 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      backProps,
      closeProps,
      continuous,
Severity: Major
Found in src/components/Tooltip/Container.js - About 2 hrs to fix

Function componentDidUpdate has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
Open

  componentDidUpdate(prevProps) {
    const {
      action,
      callback,
      continuous,
Severity: Minor
Found in src/components/Step.js - About 2 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 componentDidUpdate has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
Open

  componentDidUpdate(prevProps, prevState) {
    if (!canUseDOM) return;

    const { action, controlled, index, lifecycle, status } = this.state;
    const { debug, run, stepIndex, steps } = this.props;
Severity: Minor
Found in src/components/index.js - About 2 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 isEqual has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

export function isEqual(left: any, right: any): boolean {
  let type;
  const hasReactElement = isValidElement(left) || isValidElement(right);
  const hasUndefined = is.undefined(left) || is.undefined(right);

Severity: Minor
Found in src/modules/helpers.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 scrollToStep has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

  scrollToStep(prevState) {
    const { index, lifecycle, status } = this.state;
    const {
      debug,
      disableScrolling,
Severity: Minor
Found in src/components/index.js - About 55 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

Avoid deeply nested control flow statements.
Open

          if (['top', 'right', 'left'].includes(placement) && !flipped && !hasCustomScroll) {
            scrollY = Math.floor(popper.top - scrollOffset);
          } else {
            scrollY -= step.spotlightPadding;
          }
Severity: Major
Found in src/components/index.js - About 45 mins to fix

Function createStore has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
Open

export default function createStore(props: StoreState): StoreInstance {
  const store: Map<string, any> = new Map();
  const data: Map<string, any> = new Map();

  class Store {
Severity: Minor
Found in src/modules/store.js - About 35 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

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in src/modules/helpers.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in src/modules/helpers.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return true;
Severity: Major
Found in src/modules/helpers.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in src/modules/helpers.js - About 30 mins to fix
Severity
Category
Status
Source
Language