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()
- Read upRead up
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)
- Read upRead up
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)
- Read upRead up
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: '',
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
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)
- Read upRead up
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
}
- Read upRead up
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)
Function dispatch
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
dispatch({event, payload}) {
let canceled = false, curProm
const cancel = () => {
canceled = true
}
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 = () => {
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()
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 = []
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)
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({
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 = () => {
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))
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)
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()
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',
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) }