Showing 47 of 53 total issues
Function backQuote
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
const backQuote: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean | never => {
// store "next" postion character.
let ch: TBD<string>;
// cache start offset
- 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 slash
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
const slash: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean => {
// cache start offset
const startOffset = ctx.offset;
// fetch next char.
- 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 getTransformer
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
const getTransformer: NsGulpRmc.TTransformerFactory = (
/* istanbul ignore next */
options = {}
): NsGulpRmc.StreamTransform => {
- 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 getExtraArgs
has a Cognitive Complexity of 29 (exceeds 5 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`
- 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 apply
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
const apply = (src: string, opt: TRemoveCStyleCommentsOpt): string => {
//
// step 1. remove {line, block} comments
//
- 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 detectRegex
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export const detectRegex = (line: string): TBC<TRegexDetectResult> => {
if (!reValidFirst.test(line) || reLFCR.test(line)) return null;
let groupIndex = 0,
- 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 a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
fn() {
const thisPackage = utils.readJson("./package.json");
const recordPath = params.dest || "./logs/webpack-size.json";
/** @type {Record<TVersionString, { webpack?: number; umd?: number}>} */
const sizeRecord = fs.existsSync(recordPath)? utils.readJson(recordPath): {};
- 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 task
has 92 lines of code (exceeds 25 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]" : ".";
Function createWebpackProgressPluginHandler
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function createWebpackProgressPluginHandler(logFilePath, disableRenderLine = false) {
const formatPercentage = (/** @type {number} */pct) => {
return `processing ${(pct * 100).toFixed(4)}%`;
};
- 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 js-scanner.ts
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Copyright (C) 2020 jeffy-g <hirotom1107@gmail.com>
Released under the MIT license
https://opensource.org/licenses/mit-license.php
Function slash
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
const slash: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean => {
// cache start offset
const startOffset = ctx.offset;
// fetch next char.
Function processSources
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function processSources(
taskName,
process, {
base = "./build", bases,
test = /\.js$/,
- 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 tools.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env node
/*!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Copyright (C) 2019 jeffy-g <hirotom1107@gmail.com>
Released under the MIT license
Function apply
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const apply = (src: string, opt: TRemoveCStyleCommentsOpt): string => {
//
// step 1. remove {line, block} comments
//
Function getTransformer
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getTransformer: NsGulpRmc.TTransformerFactory = (
/* istanbul ignore next */
options = {}
): NsGulpRmc.StreamTransform => {
Function createWebpackConfig
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createWebpackConfig = (target, output, mode = "production", extraOpt = {}) => {
const {
beautify,
forceSourceMap,
Function fn
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn() {
const thisPackage = utils.readJson("./package.json");
const recordPath = params.dest || "./logs/webpack-size.json";
/** @type {Record<TVersionString, { webpack?: number; umd?: number}>} */
const sizeRecord = fs.existsSync(recordPath)? utils.readJson(recordPath): {};
Function detectRegex
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const detectRegex = (line: string): TBC<TRegexDetectResult> => {
if (!reValidFirst.test(line) || reLFCR.test(line)) return null;
let groupIndex = 0,
Function grmcBatchTest
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const grmcBatchTest = () => {
console.log(settings);
// 2020/4/14
grmc.getRmcInterface().setListener(
Function eachModule
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function eachModule(path: string) {
let grmc: typeof import("../src/gulp/");
beforeAll(async () => {
grmc = await import(path);