@lx-frontend/lx-complexity
v1.0.0-beta.3
Published
This is a package for calculating code complexity
Downloads
15
Maintainers
Keywords
Readme
@lx-frontend/lx-complexity
用于计算项目中函数的圈复杂度
Usage
const lxComplexity = require('@lx-frontend/lx-complexity');
lxComplexity() // 返回下面格式的JSON数组 ⬇️
/*
interface Message {
ruleId: string;
method: string;
complexity: number;
line: number;
column: number;
message: string;
nodeType: string;
}
// 复杂度信息对象 具体含义可以看下方说明
interface Complexity {
file: string; // 文件所在目录
message: Message; // 复杂度分析信息
}
type ComplexityData = Complexity[];
*/
Return
| 字段 | 说明 | 类型 | | ---------- | ------------------------------------------ | ------ | | ruleId | Eslint检查对应的ruleId(这里值为complexity) | String | | method | 函数名 | String | | complexity | 圈复杂度 | Number | | line | 对应的行数 | Number | | column | 对应的列数 | Number | | message | Eslint检查返回的信息 | String | | nodeType | Eslint解析函数对应的节点类型 | String |