如何在Checkstyle中手动插入错误?
我正在尝试做一些看似奇怪但有意义的事情。我想从我的代码中手动触发 Checkstyle 中的违规行为。
假设我正在开发一个所有代码都是用法语编写的项目。 (是的,我是法国人)。在代码审查期间,如果项目中有一些英文标签/类名/文件名/任何剩余的内容,我想进行注释以触发 CheckStyle 错误/警告。
为什么要这样做而不是立即纠正?好吧,因为将某些内容从英语重命名为法语可能需要一些大量的重构,因此不能简单地完成。但我确实想在我的 CheckStyle 报告中跟踪它。
那么我可以使用某种神奇的注释吗?
PS:我想在 Java (CheckStyle) 和 PHP (PHP_CodeSniffer) 中使用它。 谢谢,
I'm trying to do something that might seem strange but that makes sense. I would like to manually trigger a violation in Checkstyle from within in my code.
Let's say I'm working on a project where all code is written in french. (Yes, I'm french). While during code review, if there are some english labels/class names/file names/whatever left in the project, I would like to annotate then in order to trigger CheckStyle errors/warnings.
Why do that instead of correct it immediatly? Well, because renaming something from english to french might need some heavy refactoring and thus cannot be done simply. But I do want to keep track of it in my CheckStyle reports.
So is there some kind of magic annotation I can use?
PS : I would like to use it both in Java (CheckStyle) and PHP (PHP_CodeSniffer).
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只想插入一条 TODO 注释。 Checkstyle 有一个名为 TodoComment 的检查
I would just insert a TODO-comment. Checkstyle has a check for that called TodoComment