Showing 32 of 42 total issues
File a11y-node.js
has 822 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2025 Ruslan Sagitov
*
File role-from-tag.js
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2025 Ruslan Sagitov
*
A11yNode
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class A11yNode {
constructor(node) {
this.node = node;
this.childs = [];
Function isDescendantsValid
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
isDescendantsValid(limits) {
let node = this.firstChild,
nodeCount = 0,
role, lim;
for (; node; node = node.nextSibling) {
- 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 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
let browsers,
reporters = ['dots'];
if (process.env.KARMA_BROWSERS) {
Function setRole
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function setRole(node) {
let getRole = TAG_TO_ROLE[node.tag] || '',
roleData, role;
roleData = isFunction(getRole) ? getRole.call(this, node) : getRole;
- 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 ownedByValidRolesFor
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
ownedByValidRolesFor(role) {
let context = ROLE_CONTEXT[role];
if (!context) {
return 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 isHidden
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
isHidden(inst) {
let node = this.node;
if (this.nodeType !== 1) {
return false;
- 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 isNodeNonEmpty
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
isNodeNonEmpty(node) {
node = node.firstChild;
for (; node; node = node.nextSibling) {
if (node.nodeType === 1) {
if (node.hidden) {
- 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 pushStates
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function pushStates(result, node) {
if (typeof node.checked !== 'undefined') {
result.push(node.checked === 'mixed' ? 'mixed' :
node.checked ? 'checked' : 'not checked');
}
- 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 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(node) {
let that = this,
result = [],
ids;
Function setLocalAttrs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function setLocalAttrs(node) {
let role = node.role,
attrs = ROLE_LOCAL_ATTRS[role] || [];
for (let attr of attrs) {
- 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 range
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function range(roleName) {
return function(node) {
let role = node.role,
valuetext = node.valuetext,
valuenow = node.valuenow,
Function getTextContentFromDirectChild
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
getTextContentFromDirectChild(childName) {
let node = this.firstChild,
iter;
for (; node; node = node.nextSibling) {
if (node.nodeType !== 1) {
- 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 isHidden
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
isHidden(inst) {
let node = this.node;
if (this.nodeType !== 1) {
return false;
Function isDescendantsValid
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
isDescendantsValid(limits) {
let node = this.firstChild,
nodeCount = 0,
role, lim;
for (; node; node = node.nextSibling) {
Function fixRole
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function fixRole(node) {
let role = node.role;
if (role && role !== 'presentation') {
if (!node.ownsValidRolesFor(role)) {
this.warn(`Element with role "${role
- 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 pushProperties
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pushProperties(result, node) {
if (node.required) {
result.push('required');
}
Function setRole
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setRole(node) {
let getRole = TAG_TO_ROLE[node.tag] || '',
roleData, role;
roleData = isFunction(getRole) ? getRole.call(this, node) : getRole;
Avoid deeply nested control flow statements. Open
if (!node.isDescendantsValid(lim)) {
return false;
}