Function handle
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
handle(member) {
const { node, parent, parentPath } = member;
if (member.isOptionalMemberExpression()) {
// Transforming optional chaining requires we replace ancestors.
- 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 handle
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
handle(member) {
const { node, parent, parentPath } = member;
if (member.isOptionalMemberExpression()) {
// Transforming optional chaining requires we replace ancestors.
File index.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as t from "@babel/types";
class AssignmentMemoiser {
constructor() {
this._map = new WeakMap();
Consider simplifying this complex logical expression. Open
if (
// for (MEMBER of ARR)
// for (MEMBER in ARR)
parentPath.isForXStatement({ left: node }) ||
// { KEY: MEMBER } = OBJ
Function isInDetachedTree
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function isInDetachedTree(path) {
while (path) {
if (path.isProgram()) break;
const { parentPath, container, listKey } = path;
- 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
if (startingOptional.node.optional) break;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Function toNonOptional
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function toNonOptional(path, base) {
const { node } = path;
if (path.isOptionalMemberExpression()) {
return t.memberExpression(base, node.property, node.computed);
}
- 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"