zingchart/zingtouch

View on GitHub

Showing 28 of 50 total issues

Function constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(options) {
    super();

    /**
     * The type of the Gesture.
Severity: Minor
Found in src/gestures/Pan.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

Function constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(options) {
    super();

    /**
     * The type of the Gesture.
Severity: Minor
Found in src/gestures/Tap.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 null;
Severity: Major
Found in src/gestures/Swipe.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return null;
    Severity: Major
    Found in src/gestures/Tap.js - About 30 mins to fix

      Function move has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        move(inputs, state, element) {
          const numActiveInputs = state.numActiveInputs();
          if (this.numInputs !== numActiveInputs) return null;
      
          let currentPivot, initialPivot;
      Severity: Minor
      Found in src/gestures/Rotate.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

      Function move has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        move(inputs, state, element) {
          for (let i = 0; i < inputs.length; i++) {
            if (inputs[i].getCurrentEventType() === 'move') {
              let current = inputs[i].current;
              let previous = inputs[i].previous;
      Severity: Minor
      Found in src/gestures/Tap.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

      Function move has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        move(inputs, state, element) {
          if (state.numActiveInputs() === DEFAULT_INPUTS) {
            const currentDistance = util.distanceBetweenTwoPoints(
              inputs[0].current.x,
              inputs[1].current.x,
      Severity: Minor
      Found in src/gestures/Distance.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

      Function bind has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        bind(element, gesture, handler, capture, bindOnce) {
          if (!element || (element && !element.tagName)) {
            throw 'Bind must contain an element';
          }
      
      
      Severity: Minor
      Found in src/core/classes/Region.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