Function getAttachmentPath
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
getAttachmentPath() {
let path = this._getAttachmentPath();
if (!path) return;
let targetScope = path.scope;
- 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 _getAttachmentPath
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
_getAttachmentPath() {
const scopes = this.scopes;
const scope = scopes.pop();
// deopt: no compatible scopes
- 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 ReferencedIdentifier
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
ReferencedIdentifier(path, state) {
// Don't hoist regular JSX identifiers ('div', 'span', etc).
// We do have to consider member expressions for hoisting (e.g. `this.component`)
if (
path.isJSXIdentifier() &&
- 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 ReferencedIdentifier
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReferencedIdentifier(path, state) {
// Don't hoist regular JSX identifiers ('div', 'span', etc).
// We do have to consider member expressions for hoisting (e.g. `this.component`)
if (
path.isJSXIdentifier() &&
Function getAttachmentPath
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getAttachmentPath() {
let path = this._getAttachmentPath();
if (!path) return;
let targetScope = path.scope;
Avoid deeply nested control flow statements. Open
if (this.getAttachmentParentForPath(violationPath).key > path.key) {
path = violationPath;
}
Function run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
run() {
this.path.traverse(referenceVisitor, this);
if (this.mutableBinding) 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
Avoid too many return
statements within this function. Open
return this.getNextScopeAttachmentParent();
Function getCompatibleScopes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getCompatibleScopes() {
let scope = this.path.scope;
do {
if (this.isCompatibleScope(scope)) {
this.scopes.push(scope);
- 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"