Function count_to_path
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
exports.count_to_path = function count_to_path(root, path) {
let data;
if ((protocolKey.DATA in root) == false) {
return null;
}
- 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 extract_decendants
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports.extract_decendants = function extract_decendants(root, path) {
const decendants = [];
const start = exports.get_struct(root, path);
if (start != null) {
if (protocolKey.DATA in start) {
- 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 extract_branches
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
exports.extract_branches = function extract_branches(root, path) {
const start = exports.get_struct(root, path);
const branches = [];
if (start != null) {
if (protocolKey.DATA in start) {
- 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 count_to_path
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.count_to_path = function count_to_path(root, path) {
let data;
if ((protocolKey.DATA in root) == false) {
return null;
}
Function get_struct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.get_struct = function get_struct(root, path) {
if (path.length === 0) {
return root;
}
- 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 deeply nested control flow statements. Open
for (i in next_branches) {
const branch = next_branches[i];
branches.push(name + "/" + branch);
}
Avoid deeply nested control flow statements. Open
for (i in next_decendants) {
decendants.push(name + "/" + next_decendants[i]);
}
Function extract_types
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.extract_types = function extract_types(root, path) {
const start = exports.get_struct(root, path);
const types = [];
if (start != null) {
if (protocolKey.TYPE in start) {
- 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
return count;
Avoid too many return
statements within this function. Open
return null;