File index.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
import assert from "assert";
import * as t from "@babel/types";
import template from "@babel/template";
import chunk from "lodash/chunk";
Function buildNamespaceInitStatements
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function buildNamespaceInitStatements(
metadata: ModuleMetadata,
sourceMetadata: SourceModuleMetadata,
loose: boolean = false,
) {
Function buildExportInitializationStatements
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildExportInitializationStatements(
programPath: NodePath,
metadata: ModuleMetadata,
loose: boolean = false,
) {
Function buildNamespaceReexport
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildNamespaceReexport(metadata, namespace, loose) {
return (loose
? template.statement`
Object.keys(NAMESPACE).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
Function buildExportNameListDeclaration
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function buildExportNameListDeclaration(
programPath: NodePath,
metadata: ModuleMetadata,
) {
const exportedVars = Object.create(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 buildExportInitializationStatements
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function buildExportInitializationStatements(
programPath: NodePath,
metadata: ModuleMetadata,
loose: boolean = false,
) {
- 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 buildNamespaceInitStatements
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function buildNamespaceInitStatements(
metadata: ModuleMetadata,
sourceMetadata: SourceModuleMetadata,
loose: boolean = false,
) {
- 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 rewriteModuleStatementsAndPrepareHeader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function rewriteModuleStatementsAndPrepareHeader(
path: NodePath,
{
exportName,
strict,
- 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"