Function run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function run(args: string | string[], options: any = {}): any {
const { debug, output, ...opts } = options
// 开启 debug 后还需要将环境变量 DURKA_NODE_DEBUG 设置成 true
if (debug && process.env[typeof debug === 'string' ? debug : 'DURKA_NODE_DEBUG']) {
return runNodeDebug(args, opts)
- Read upRead up
- Create a ticketCreate a ticket
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 runNodeDebug
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function runNodeDebug(args: string | string[], options: runTypes.Options & SilentOptions = {}) {
const { silent, ...opts } = options
if (typeof args === 'string') {
let cmd = args
if (/^\s*node\s/.test(cmd)) {
- Read upRead up
- Create a ticketCreate a ticket
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 runOutput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function runOutput(args: string | string[], options: runTypes.Options & SilentOptions = {}) {
const { silent = true, ...opts } = options
if (typeof args === 'string') {
if (!silent) log(args)
return execa.command(args, { ...opts, stdio: 'pipe' }).then(d => d.stdout)
- Read upRead up
- Create a ticketCreate a ticket
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"