首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tslint输出圈复杂度错误

tslint输出圈复杂度错误
EN

Stack Overflow用户
提问于 2019-09-09 23:40:51
回答 1查看 1.8K关注 0票数 0

在我的angular 8项目中

代码语言:javascript
复制
"codelyzer": "^5.1.0",
"ts-node": "~8.3.0",
"tslint": "~5.19.0",

运行后:

代码语言:javascript
复制
ng lint myapp --fix=true

我得到了:

代码语言:javascript
复制
ERROR: ...html:428:106 - The cyclomatic complexity exceeded the defined limit (cost '5'). Your template should be refactored.

尽管我在tslint.js中设置了:

代码语言:javascript
复制
{
  "rulesDirectory": ["node_modules/codelyzer"],
  "rules": {
    "template-i18n": false,
    "cyclomatic-complexity": [true, 20],

为什么我在设置中设置的“”there complexity“:true,20”和我收到的许多文件的错误信息"(cost '5')“之间会有差异?

还有,为什么会发生这种情况呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-09 23:56:16

模板复杂度在不同的规则中,即:

代码语言:javascript
复制
"template-cyclomatic-complexity": [true, 6]

https://github.com/fulls1z3/angular-tslint-rules/issues/34

"cyclomatic-complexity": [true, 20],用于*.ts文件

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57857203

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档