Showing 47 of 53 total issues
Function createWebpackProgressPluginHandler
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createWebpackProgressPluginHandler(logFilePath, disableRenderLine = false) {
const formatPercentage = (/** @type {number} */pct) => {
return `processing ${(pct * 100).toFixed(4)}%`;
};
Function task
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function task(
grmc, settings, mode = "cjs"
) {
const BASE_PREFIX = settings.useExtern ? "[If you want to scan external node_modules directory etc., set path here]" : ".";
- 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 backQuote
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const backQuote: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean | never => {
// store "next" postion character.
let ch: TBD<string>;
// cache start offset
Function getExtraArgs
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getExtraArgs(args_config, debug = false) {
// debug log, if need.
debug && console.log("process.argv: ", process.argv);
/** @type {typeof ArgsConfig} */
// @ts- ignore will be not `Partial`
Function wppHandlerV5
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const wppHandlerV5 = ((renderer, cwd) => {
return (percentage, message, ...args) => {
if (!message) {
message = "- done -";
}
- 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 emitMainFunction
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const emitMainFunction = <
T extends typeof apply | typeof walk,
R extends ReturnType<T>
>(fn: T): (...args: Parameters<T>) => R => {
- 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 fn
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn: () => {
let {
major, minor/*, patch*/,
pkgJsons = ["./package.json"]
} = params;
Function transform
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const transform: NsGulpRmc.FixTransformFunction = function (vinyl, encoding, callback) {
// plugin main
if (vinyl.isBuffer()) {
if (extensions.includes(vinyl.extname)) {
Function createContext
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createContext = (options: NsGulpRmc.TOptions) => {
/** @type {TRemoveCStyleCommentsOpt} */
const opt: TRemoveCStyleCommentsOpt = {
preserveBlanks: options.preserveBlanks,
Function writeTextUTF8
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function writeTextUTF8(content, dest, callback) {
// need dest parent dir check.
lib.checkParentDirectory(dest);
const ws = fs.createWriteStream(dest)
Consider simplifying this complex logical expression. Open
if (settings.p === true) {
const stdin = process.stdin;
stdin.resume().setEncoding("utf8");
inputs = "";
Function writeTextUTF8
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function writeTextUTF8(content, dest, callback) {
// need dest parent dir check.
lib.checkParentDirectory(dest);
const ws = fs.createWriteStream(dest)
- 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 quote
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const quote: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean => {
const startOffset = ctx.offset;
const q = src[startOffset];
// limiter
- 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 (!ctx.isWalk) {
ctx.result += src.substring(prevOffset, next);
}
Avoid deeply nested control flow statements. Open
if (!inspectable) {
next++;
continue;
}
Avoid deeply nested control flow statements. Open
if (scanListener!(eventContext)) {
ctx.result += fragment;
}
Avoid deeply nested control flow statements. Open
if (code === EMetaChars.RIGHT_CURLY) {
startOffset = ++next;
/* https://coderwall
when(prevOffset);
/*/
Avoid deeply nested control flow statements. Open
if (value === void 0 || value.startsWith(actualConfig.prefix)) {
value = true;
} else {
// DEVNOTE: now possible to process array parameters
// DEVNOTE: 2020/2/28 - support regex parameter
Consider simplifying this complex logical expression. Open
if (
(prevEntry.webpack && entry.webpack) && (prevEntry.webpack ^ entry.webpack) ||
(prevEntry.umd && entry.umd) && (prevEntry.umd ^ entry.umd)
) {
sizeRecord[versionStr] = entry;
Function lookupRegexes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const lookupRegexes = (nl: TDetectedNewLines) => {
return {
/**
* regex: whitespaces, quoted string, regexp literal
*
- 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"