Sonar category of TODO warnings

こ雲淡風輕ζ 提交于 2019-12-11 06:26:31

问题


In my code I have different types of TODO items:

  • Some are meant to be like "this totally needs to be done"
  • Others are more like "if you ever feel bored, why not add this?"

An example for this would be in my IntelliJ-Plugin: there is a refresh method in a VirtualFileSystem which would be kinda user friendly to be implemented eventually, but everything works perfectly fine even without it, so it is more like a // NICETOHAVE: and not a // TODO:.

I like to add comments like that to the code but since I am using Sonar to inspect my code base this creates some nasty inspection warnings and IntelliJ keeps bugging me when pushing my code in VCS.

So my question is, is there some other way to annotate things in my code that could be nice to implement eventually but it does not matter if you ever come to actually do it while still having some nice highlighting?


回答1:


There are only two rules tracking comments : TODO and FIXME

If you want to track other comments you might be better of writing your custom rule (because there is no plan to add customization to those rules) and you can get inspiration of how to do this by looking at the source code of the java plugin : FixMeTagPresenceCheck and CommentContainsPatternChecker



来源:https://stackoverflow.com/questions/40980607/sonar-category-of-todo-warnings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!