简体   繁体   English

如何在Checkstyle中手动插入错误?

[英]How to manually insert error in Checkstyle?

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. 我想在我的代码中从内部手动触发Checkstyle中的违规。

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. 在代码审查期间,如果项目中还剩下一些英语标签/类名称/文件名/内容,我想在此添加注释,以触发CheckStyle错误/警告。

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. 但我确实想在CheckStyle报告中跟踪它。

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). PS:我想在Java(CheckStyle)和PHP(PHP_CodeSniffer)中使用它。 Thanks, 谢谢,

I would just insert a TODO-comment. 我只想插入一个TODO评论。 Checkstyle has a check for that called TodoComment Checkstyle有一个名为TodoComment的支票

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM