RubyLouvre/avalon

View on GitHub
src/gesture/recognizer.js

Summary

Maintainability
C
1 day
Test Coverage

Function iOSversion has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function iOSversion() {
    //https://developer.apple.com/library/prerelease/mac/releasenotes/General/WhatsNewInSafari/Articles/Safari_9.html
    //http://mp.weixin.qq.com/s?__biz=MzA3MDQ4MzQzMg==&mid=256900619&idx=1&sn=b29f84cff0b8d7b9742e5d8b3cd8f218&scene=1&srcid=1009F9l4gh9nZ7rcQJEhmf7Q#rd
    if (/iPad|iPhone|iPod/i.test(ua) && !window.MSStream) {
        if ("backdropFilter" in document.documentElement.style) {
Severity: Minor
Found in src/gesture/recognizer.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 move has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    move: function(event, callback) {
        for (var i = 0; i < event.changedTouches.length; i++) {
            var touch = event.changedTouches[i]
            var pointer = Recognizer.pointers[touch.identifier]
            if (!pointer) {
Severity: Minor
Found in src/gesture/recognizer.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 move has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    move: function(event, callback) {
        for (var i = 0; i < event.changedTouches.length; i++) {
            var touch = event.changedTouches[i]
            var pointer = Recognizer.pointers[touch.identifier]
            if (!pointer) {
Severity: Minor
Found in src/gesture/recognizer.js - About 1 hr to fix

    Function add has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        add: function(name, recognizer) {
            function move(event) {
                recognizer.touchmove(event)
            }
    
    
    Severity: Minor
    Found in src/gesture/recognizer.js - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

                  return 5
      Severity: Major
      Found in src/gesture/recognizer.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 3
        Severity: Major
        Found in src/gesture/recognizer.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 4
          Severity: Major
          Found in src/gesture/recognizer.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return NaN
            Severity: Major
            Found in src/gesture/recognizer.js - About 30 mins to fix

              Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
              Open

              export {
              Severity: Minor
              Found in src/gesture/recognizer.js by eslint

              For more information visit Source: http://eslint.org/docs/rules/

              There are no issues that match your filters.

              Category
              Status