在 Detekt 中配置规则
I am adding Detekt to a new project.
But, I find that some rules are too strict.
How can I implement my own thresholds for a few rules?
I don't want to use Baseline files, because this is new code and we don't want to consider some things code smells.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以通过配置文件配置 Detekt。
根据 Detekt 文档,我强调:
您需要创建一个
配置 code> 文件夹位于项目根目录中,并将
detekt.yaml
添加到其中。此配置将包含您想要覆盖默认值的所有规则,或所有规则(将默认值建立为正确的值)。更多信息,查看官方配置文档
It's possible to configure Detekt via configuration files.
As per Detekt's documentation, with my emphasis:
You'll want to create a
config
folder in the root of your project, and adddetekt.yaml
to it. This config will contain all the rules that you want to override the default, or all the rules (establishing the defaults as the correct value).For more information, check the official documentation on configuration