Showing 1,982 of 1,982 total issues
Avoid deeply nested control flow statements. Open
if (DECIMAL_NUMBER.test(str)) {
entity = String.fromCodePoint(parseInt(str, 10));
}
Avoid deeply nested control flow statements. Open
if (this.input.charCodeAt(this.state.pos) === charCodes.lineFeed) {
++this.state.pos;
}
Avoid deeply nested control flow statements. Open
if (HEX_NUMBER.test(str)) {
entity = String.fromCodePoint(parseInt(str, 16));
}
Avoid deeply nested control flow statements. Open
if (lastChild.leadingComments[i].end <= node.start) {
node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
break;
}
Avoid deeply nested control flow statements. Open
if (!isFrom && specifier.local) {
// check for keywords used as local names
this.checkReservedWord(
specifier.local.name,
specifier.local.start,
Avoid deeply nested control flow statements. Open
if (
node.declaration.type === "FunctionDeclaration" ||
node.declaration.type === "ClassDeclaration"
) {
const id = node.declaration.id;
Avoid deeply nested control flow statements. Open
for (j = 0; j < this.state.leadingComments.length; j++) {
if (
this.state.leadingComments[j].end <
this.state.commentPreviousNode.end
) {
Avoid deeply nested control flow statements. Open
if (this.state.leadingComments[i].end > node.start) {
break;
}
Function parseDecorator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
parseDecorator(): N.Decorator {
this.expectOnePlugin(["decorators-legacy", "decorators"]);
const node = this.startNode();
this.next();
- 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 (this.isNonstaticConstructor(publicMethod)) {
this.raise(publicMethod.key.start, Errors.ConstructorIsAsync);
}
Avoid deeply nested control flow statements. Open
} else if (this.isLineTerminator()) {
// an uninitialized class property (due to ASI, since we don't otherwise recognize the next token)
if (isPrivate) {
this.pushClassPrivateProperty(classBody, privateProp);
} else {
Avoid deeply nested control flow statements. Open
if (method.key.type === "PrivateName") {
// private getter/setter
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
} else {
if (this.isNonstaticConstructor(publicMethod)) {
Function pushClassPrivateMethod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
pushClassPrivateMethod(
classBody: N.ClassBody,
method: N.ClassPrivateMethod,
isGenerator: boolean,
isAsync: boolean,
- 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
} else if (isEmptyStatement(node)) {
// empty statement so ensure the last item is undefined if we're last
ensureLastUndefined = true;
} else {
// bailed, we can't turn this statement into an expression
Avoid deeply nested control flow statements. Open
if (reexport) {
localData.delete(localName);
reexport.names.forEach(name => {
data.reexports.set(name, importName);
Avoid deeply nested control flow statements. Open
if (!t.isStatement(replacement)) {
replacement = t.expressionStatement((replacement: any));
}
Function get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
get(member) {
const { classRef, privateNamesMap, file } = this;
const { name } = member.node.property.id;
const {
id,
- 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 createTypeAnnotationBasedOnTypeof
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function createTypeAnnotationBasedOnTypeof(
type: string,
): Object {
if (type === "string") {
return stringTypeAnnotation();
- 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
} else if (parentKey === "meta") {
if (is("MetaProperty", parent, { meta: node })) return;
}
Avoid deeply nested control flow statements. Open
if (typeof replacement === "string") {
replacement = t.identifier(replacement);
}