Showing 22 of 32 total issues
File features.js
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Features module.
* @module base/features
*/
- Create a ticketCreate a ticket
Function to
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
to(options = {}) {
let timeX = 0
let timeY = 0
let currentTime = 0
let rootElement = Array.isArray(this._opts.rootElement)
- Create a ticketCreate a ticket
Function init
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function init(container = document.body, name = null, options = {}) {
options = Object.assign({}, defaultInitOptions, options)
const instances = []
const names = name ? name.split(ATTR_FEATURES_SEPARATOR) : null
- Create a ticketCreate a ticket
Function to
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
to(options = {}) {
let timeX = 0
let timeY = 0
let currentTime = 0
let rootElement = Array.isArray(this._opts.rootElement)
- Read upRead up
- Create a ticketCreate a ticket
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 loadExternals
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function loadExternals(bundles, assetPath) {
let elements = document.querySelectorAll(`[${ATTR_EXTERNAL_SCRIPT}]`)
let features = getFeatures()
let scripts = []
let scriptsLoaded = []
- Create a ticketCreate a ticket
Function debounce
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function debounce(func, wait = 60, immediate = false) {
var timeout, args, context, timestamp, result
function later() {
var last = Date.now() - timestamp
- Read upRead up
- Create a ticketCreate a ticket
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 lazyload
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function lazyload(bundles, assetPath) {
if (!bundles || !assetPath) {
throw Error('Cannot lazyload features without a bundles file or a path!')
}
- Create a ticketCreate a ticket
Function destroy
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function destroy(container = document.body, name = null, options = {}) {
options = Object.assign({}, defaultDestroyOptions, options)
const names = name ? name.split(ATTR_FEATURES_SEPARATOR) : null
const featureNodes = [...container.querySelectorAll(`[${ATTR_FEATURES}]`)]
- Create a ticketCreate a ticket
Function debounce
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function debounce(func, wait = 60, immediate = false) {
var timeout, args, context, timestamp, result
function later() {
var last = Date.now() - timestamp
- Create a ticketCreate a ticket
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(env = {}) {
var entry = path.join(root, process.env.SOURCE_PATH, 'index.js')
var outputPath = path.join(root, process.env.LIBRARY_PATH)
var outputFile = LIBRARY_NAME + '.js'
- Create a ticketCreate a ticket
Function getRelevantBundles
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function getRelevantBundles(bundles) {
const features = getFeatures()
let extElements = document.querySelectorAll(`[${ATTR_EXTERNAL_SCRIPT}]`)
let extFeatures = []
let optimizedBundles = {}
- Create a ticketCreate a ticket
Function lazyload
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function lazyload(bundles, assetPath) {
if (!bundles || !assetPath) {
throw Error('Cannot lazyload features without a bundles file or a path!')
}
- Read upRead up
- Create a ticketCreate a ticket
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 tick
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tick() {
currentTime += 1 / 60
let p = currentTime / time
let t = easingEquations[opts.easing](p)
- Create a ticketCreate a ticket
Function removeEventListener
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
removeEventListener(node, type = null, fn = null) {
if (!isElement(node) && node !== window) {
let currentNode = node.length
while (currentNode--) {
this.removeEventListener(node[currentNode], type, fn)
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
nodeInstances.hasOwnProperty(featureName) &&
(!name || names.indexOf(featureName) > -1) && // name is whitelisted
(!ignoreFeatures || ignoreFeatures.indexOf(featureName) < 0) && // feature is ignore on this node
(featureNode._baseFeatureInstances && // feature instance exists
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
!feature || // feature has not been added yet
(ignoreFeatures && ignoreFeatures.indexOf(featureName) > -1) || // feature is ignored on this node
(name && names.indexOf(featureName) < 0) || // name is not whitelisted
(featureNode._baseFeatureInstances && // feature has already been initalized on this node
- Create a ticketCreate a ticket
Function loadExternals
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export async function loadExternals(bundles, assetPath) {
let elements = document.querySelectorAll(`[${ATTR_EXTERNAL_SCRIPT}]`)
let features = getFeatures()
let scripts = []
let scriptsLoaded = []
- Read upRead up
- Create a ticketCreate a ticket
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 isEmpty
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function isEmpty(value) {
// compare value with values considered as empty
for (let i = 0, len = EMPTY_DEFINITIONS.length; i < len; i++) {
if (value === EMPTY_DEFINITIONS[i]) {
return true
- Read upRead up
- Create a ticketCreate a ticket
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 parents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function parents(element, match = null) {
let parents = []
for (; element && element !== document; element = element.parentNode) {
if (match) {
- Read upRead up
- Create a ticketCreate a ticket
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 addEventListener
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
addEventListener(node, type, fn, options = {}) {
if (!isElement(node) && node !== window) {
let currentNode = node.length
while (currentNode--) {
this.addEventListener(node[currentNode], type, fn, options)
- Read upRead up
- Create a ticketCreate a ticket
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"