Showing 1,251 of 1,982 total issues
Function completionRecordForSwitch
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function completionRecordForSwitch(cases, paths) {
let isLastCaseWithConsequent = true;
for (let i = cases.length - 1; i >= 0; i--) {
const switchCase = cases[i];
- 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 getBindingIdentifierPaths
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export function getBindingIdentifierPaths(
duplicates?: boolean = false,
outerOnly?: boolean = false,
): { [string]: NodePath } {
const path = this;
- 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
File estree.js
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import { types as tt, TokenType } from "../tokenizer/types";
import type Parser from "../parser";
import type { ExpressionErrors } from "../parser/util";
Function readTmplToken
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
readTmplToken(): void {
let out = "",
chunkStart = this.state.pos,
containsInvalid = false;
for (;;) {
- 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 getBindingIdentifiers
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export default function getBindingIdentifiers(
node: Object,
duplicates?: boolean,
outerOnly?: boolean,
): { [string]: Object | Array<Object> } {
- 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
File index.js
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { declare } from "@babel/helper-plugin-utils";
import { addDefault, isModule } from "@babel/helper-module-imports";
import { types as t } from "@babel/core";
import getCoreJS2Definitions from "./runtime-corejs2-definitions";
Function buildRollup
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildRollup(packages) {
const sourcemap = process.env.NODE_ENV === "production";
const minify = !!process.env.IS_PUBLISH;
return Promise.all(
packages.map(
File index.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { declare } from "@babel/helper-plugin-utils";
import syntaxTypeScript from "@babel/plugin-syntax-typescript";
import { types as t, template } from "@babel/core";
import { injectInitialization } from "@babel/helper-create-class-features-plugin";
Function enter
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
enter(path, state) {
if (hasJSX(path)) {
const { file } = state;
let runtime = RUNTIME_DEFAULT;
Consider simplifying this complex logical expression. Open
if (
nodeType === "Immutable" ||
"StringLiteral" === nodeType ||
"NumericLiteral" === nodeType ||
"NullLiteral" === nodeType ||
Function parseStatementContent
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseStatementContent(context: ?string, topLevel: ?boolean): N.Statement {
let starttype = this.state.type;
const node = this.startNode();
let kind;
Function flowParseObjectType
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
flowParseObjectType({
allowStatic,
allowExact,
allowSpread,
allowProto,
Function getModuleMetadata
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function getModuleMetadata(
programPath: NodePath,
{ loose, lazy }: { loose: boolean, lazy: boolean },
) {
const localData = getLocalExportMetadata(programPath, loose);
- 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 buildHas
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
buildHas(ret: string) {
const body = this.body;
let retCheck;
const has = this.has;
- 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 parseArgv
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function parseArgv(args: Array<string>): CmdOptions | null {
//
commander.parse(args);
const errors = [];
Function exports
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (api) {
const env = api.env();
const includeCoverage = process.env.BABEL_COVERAGE === "true";
Function gatherNodeParts
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
function gatherNodeParts(node: Object, parts: Array) {
switch (node?.type) {
default:
if (t.isModuleDeclaration(node)) {
if (node.source) {
File normalize-and-load-metadata.js
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { basename, extname } from "path";
import splitExportDeclaration from "@babel/helper-split-export-declaration";
export type ModuleMetadata = {
Function ReferencedIdentifier
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
ReferencedIdentifier(path, state) {
const { node } = path;
// we can't guarantee the purity of arguments
if (node.name === "arguments") {
- 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 handleNested
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleNested(path, t, node, parentExport) {
const names = new Set();
const realName = node.id;
const name = path.scope.generateUid(realName.name);
const namespaceTopLevel = node.body.body;