lib/test-type/aria-templates/at-file-reader.js
Function readATNewFileContent
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
function readATNewFileContent(res, fileContent, fileName) {
var foundClassDef = null;
var walker = new UglifyJS.TreeWalker(function (node) {
var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
if (!isAssignment) return;
- 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 readATNewFileContent
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function readATNewFileContent(res, fileContent, fileName) {
var foundClassDef = null;
var walker = new UglifyJS.TreeWalker(function (node) {
var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
if (!isAssignment) return;
Function readATOldFileContent
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function readATOldFileContent(res, fileContent, fileName) {
var classDef = null;
var classDefinitionCalls = 0;
var sandbox = {
aria: {
Function walker
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var walker = new UglifyJS.TreeWalker(function (node) {
var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
if (!isAssignment) return;
var moduleExports = node.left;
var isDotExports = moduleExports instanceof UglifyJS.AST_Dot && moduleExports.property == "exports";
Function readRequire
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function readRequire(expression) {
if (expression instanceof UglifyJS.AST_Call && expression.args.length == 1) {
var requireVar = expression.expression;
if (requireVar instanceof UglifyJS.AST_SymbolRef && requireVar.name == "require" && requireVar.thedef.undeclared) {
var param = expression.args[0];
- 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
Avoid too many return
statements within this function. Open
Open
if (!isDotClassDefinition) return;
Avoid too many return
statements within this function. Open
Open
if (!isObjectLitteral) return;
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
if (!(ariaRef && /^aria(templates)?\/Aria(\.js)?$/.test(ariaRef))) return;
Avoid too many return
statements within this function. Open
Open
return true;