知识卡片

操作参考卡 · 10296.b.1.b.2.a.2 · 生成模型:未记录

用级别控制Lint阻断

理解等级:中级

规则的 severity 管理哪些发现更紧急。Spectral CLI 可用 --fail-severity 设失败阈值,任何发现达到阈值就产生失败退出码供 CI 使用。治理初期可以允许低级别项先作为提醒。规则的消息应说明具体问题,便于开发直接修正。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • API Lint 与设计一致性 3.6 Creating a Spectral rule for info.description · 查看原书依据

      Finally, the rule’s severity property specifies the severity level associated with the rule to enable you to group and filter rule violations by importance. When you run the Spectral CLI, you can also use the --fail-severity flag to specify that the failure of a rule with the given severity level (or higher) will trigger a failure exit code. In order of highest to lowest, Spectral has five severity levels for error results: error, warn, info, hint, and off.

    参考来源

    - 位置:《Automating API Delivery APIOps with OpenAPI》《第 03 章 API Lint 与设计一致性》(3.6 Creating a Spectral rule for info.description;来源项目 book-source,extracted/Automating API Delivery APIOps with OpenAPI/_epub-src/OEBPS/Text/chapter-3.xhtml#p66) - 结论依据:原文区分规则级别与命令行失败阈值,并列出 error、warn、info、hint 和 off。 - 原始内容:Finally, the rule’s severity property specifies the severity level associated with the rule to enable you to group and filter rule violations by importance. When you run the Spectral CLI, you can also use the --fail-severity flag to specify that the failure of a rule with the given severity level (or higher) will trigger a failure exit code. In order of highest to lowest, Spectral has five severity levels for error results: error, warn, info, hint, and off.