T4rk1n/tarkjs

View on GitHub

Showing 36 of 36 total issues

Function xhrRequest has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export const xhrRequest = (url, options=defaultXhrOptions) => {
    let cancel = () => {}
    const promise = new Promise((resolve, reject) => {
        const {method, headers, payload} = {...defaultXhrOptions, ...options}
        const xhr = new XMLHttpRequest()
Severity: Minor
Found in src/requests/requests.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 promiseWrap has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export const promiseWrap = (func, options=defaultPromiseWrapOptions) => {
    let canceled = false,
        cancel = () => {},
        reqId = -1
    const { rejectNull, nullMessage, args } = objExtend({}, defaultPromiseWrapOptions, options)
Severity: Minor
Found in src/extensions/prom-extensions.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 deflate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const deflate = (elem, options=defaultAnimationOptions) => {
    const { division } = {...defaultAnimationOptions, ...options}
    const decrementX = Math.ceil(elem.offsetWidth / division)
    const decrementY = Math.ceil(elem.offsetHeight / division)
    const decrementFont = Math.ceil(getFontSize(elem) / division)
Severity: Minor
Found in src/dom/animations/animations.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 exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(config) {
    config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '',
Severity: Minor
Found in karma.conf.js - About 1 hr to fix

    Function constructor has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        constructor(actions, eventBus=null) {
            this._eventBus = eventBus || new EventBus()
            const actionKeys = Object.keys(actions)
            /**
             * Centralized stores
    Severity: Minor
    Found in src/persistance/mem-stores.js - About 1 hr to fix

      Function moveOut has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      export const moveOut = (elem, options=defaultMoveOptions) => {
          const { height, width, division } = {...defaultMoveOptions, ...options}
          const moveHeight = height / division
          const moveWidth = width / division
          const offsets = getOffset(elem)
      Severity: Minor
      Found in src/dom/animations/animations.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 dispatch has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          dispatch({event, payload}) {
              let canceled = false,  curProm
              const cancel = () => {
                  canceled = true
              }
      Severity: Minor
      Found in src/event-bus/event-bus.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 promiseWrap has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const promiseWrap = (func, options=defaultPromiseWrapOptions) => {
          let canceled = false,
              cancel = () => {},
              reqId = -1
          const { rejectNull, nullMessage, args } = objExtend({}, defaultPromiseWrapOptions, options)
      Severity: Minor
      Found in src/extensions/prom-extensions.js - About 1 hr to fix

        Function dispatch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            dispatch({event, payload}) {
                let canceled = false,  curProm
                const cancel = () => {
                    canceled = true
                }
        Severity: Minor
        Found in src/event-bus/event-bus.js - About 1 hr to fix

          Function loadStyle has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const loadStyle = (styleId, cssFile, options=defaultLoadingOptions) =>  {
              let cancel = ()=>{}, loaded = false, timeoutId
              const { timeout } = objExtend({}, defaultLoadingOptions, options)
              const promise = new Promise((resolve, reject) => {
                  const onload = () => {
          Severity: Minor
          Found in src/dom/loaders.js - About 1 hr to fix

            Function xhrRequest has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const xhrRequest = (url, options=defaultXhrOptions) => {
                let cancel = () => {}
                const promise = new Promise((resolve, reject) => {
                    const {method, headers, payload} = {...defaultXhrOptions, ...options}
                    const xhr = new XMLHttpRequest()
            Severity: Minor
            Found in src/requests/requests.js - About 1 hr to fix

              Function chainPromises has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const chainPromises = (creators, options=defaultChainOptions) => {
                  let canceled = false, cancel = () => canceled = true
                  const { onChain, onError, rejectOnError } = objExtend({}, defaultChainOptions, options)
                  const promise = new Promise((resolve, reject) => {
                      let i = 0, acc = []
              Severity: Minor
              Found in src/extensions/prom-extensions.js - About 1 hr to fix

                Function deflate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const deflate = (elem, options=defaultAnimationOptions) => {
                    const { division } = {...defaultAnimationOptions, ...options}
                    const decrementX = Math.ceil(elem.offsetWidth / division)
                    const decrementY = Math.ceil(elem.offsetHeight / division)
                    const decrementFont = Math.ceil(getFontSize(elem) / division)
                Severity: Minor
                Found in src/dom/animations/animations.js - About 1 hr to fix

                  Function animate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const animate = (animations, options=defaultAnimateOptions) => {
                      let canceled = false, ts
                      const { single, repeat, infinite } = objExtend({}, defaultAnimateOptions, options)
                      const promise = new Promise((resolve, reject) => {
                          if (infinite && !single) return reject({
                  Severity: Minor
                  Found in src/dom/animations/animations.js - About 1 hr to fix

                    Function loadScript has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const loadScript = (scriptId, src, options=defaultLoadingOptions) => {
                        let cancel = () => {}, loaded = false, timeoutId
                        const { timeout } = objExtend({}, defaultLoadingOptions, options)
                        const promise = new Promise((resolve, reject) => {
                            const onload = () => {
                    Severity: Minor
                    Found in src/dom/loaders.js - About 1 hr to fix

                      Function promise has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const promise = new Promise((resolve, reject) => {
                              const {method, headers, payload} = {...defaultXhrOptions, ...options}
                              const xhr = new XMLHttpRequest()
                              xhr.open(method, url)
                              objItems(headers).forEach(([k, v]) => xhr.setRequestHeader(k, v))
                      Severity: Minor
                      Found in src/requests/requests.js - About 1 hr to fix

                        Function moveOut has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const moveOut = (elem, options=defaultMoveOptions) => {
                            const { height, width, division } = {...defaultMoveOptions, ...options}
                            const moveHeight = height / division
                            const moveWidth = width / division
                            const offsets = getOffset(elem)
                        Severity: Minor
                        Found in src/dom/animations/animations.js - About 1 hr to fix

                          Function promise has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              const promise = new Promise((resolve, reject) => {
                                  const onload = () => {
                                      loaded = true
                                      clearTimeout(timeoutId)
                                      resolve()
                          Severity: Minor
                          Found in src/dom/loaders.js - About 1 hr to fix

                            Function promise has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    const promise = new Promise((resolve, reject) => {
                                        const handlers = this.findHandlers(event)
                                        const end = handlers.length
                                        if (!handlers || handlers.length < 1) return reject({
                                            error: 'missing_handler',
                            Severity: Minor
                            Found in src/event-bus/event-bus.js - About 1 hr to fix

                              Function promise has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  const promise = new Promise((resolve, reject) => {
                                      const handle = () => {
                                          let result
                              
                                          try { result = func(...args) }
                              Severity: Minor
                              Found in src/extensions/prom-extensions.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language