Showing 28 of 52 total issues
Function peer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function peer(rootDir: string) {
const pkgFile = path.join(rootDir, 'package.json')
/* eslint-disable @typescript-eslint/no-var-requires */
const pkg = require(pkgFile)
- 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 getAllExportFiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getAllExportFiles(file: string) {
const entries: string[] = []
const stat = fs.statSync(file)
if (stat.isFile() && isModuleFile(file)) {
entries.push(file)
- 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 generateModule
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
rootDir: string,
srcDir: string,
distDir: string,
key: string,
entries: string[],
- Create a ticketCreate a ticket
Function make
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function make(options: {
/** 项目的 package.json 内容 */
pkg: any
/** 入口文件 */
entry: string
- 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 mkdir
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function mkdir(dir: string, originalDir?: string) {
const parent = path.dirname(dir)
if (parent && parent !== dir) {
if (!fs.existsSync(parent)) mkdir(parent, originalDir || dir)
fs.mkdirSync(dir)
- 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 filterVersions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function filterVersions(versions: string[], mode: VERSION_FILTER_MODE = 'all') {
const map = new Map<string, string>()
let maxMajor = -1
const targets = versions.map(v => parseVersion(v)).filter(t => t != null) as VERSION_INSTANCE[]
- 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"
Further reading
Function parseProjectInstallName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function parseProjectInstallName(installName: string) {
let scope = ''
let range = ''
let tag = ''
let name = ''
- 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"