tslint吐出圈复杂度错误

tslint spitting out cyclomatic complexity error

在我的 angular 8 个项目中

"codelyzer": "^5.1.0",
"ts-node": "~8.3.0",
"tslint": "~5.19.0",

在 运行 之后:

ng lint myapp --fix=true

我得到:

ERROR: ...html:428:106 - The cyclomatic complexity exceeded the defined limit (cost '5'). Your template should be refactored.

即使在我的 tslint.js 中我设置了 :

{
  "rulesDirectory": ["node_modules/codelyzer"],
  "rules": {
    "template-i18n": false,
    "cyclomatic-complexity": [true, 20],

为什么我在设置“"cyclomatic-complexity": [true, 20]”中设置的内容与我收到的很多文件“(cost '5')”的错误消息之间存在差异?

另外,为什么会发生这种情况?

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

"template-cyclomatic-complexity": [true, 6]

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

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