Is it possible to disable duplicate code detection

2019-01-30 16:46发布

Is it possible to disable duplicate code detection in Intellij?

I haven't found this feature to be useful and it continues to distract me.

4条回答
来,给爷笑一个
2楼-- · 2019-01-30 17:26

Java has this annotation You should use that instead of turning off the highlight function of IntelliJ Add this line above your class or pieces of code

@SuppressWarnings("Duplicates")

查看更多
3楼-- · 2019-01-30 17:33

To toggle it, go to Other Settings → Editor → Inspections → General → Duplicated Code.

You can use search field there to find the specific item.

enter image description here

查看更多
Deceive 欺骗
4楼-- · 2019-01-30 17:47

Yes, it's possible, but I would strongly advise against it!

Duplicate code is a form of technical debt. Any duplicated code that contains a bug means you now have a duplicated bug - you then run the risk that when you fix it, you'll only fix it in one place and the duplicate will remain...

If duplicate code warnings are distracting you, then the best strategy for getting rid of them is to remove the code duplication... Your codebase and future maintainers will thank you for it

查看更多
聊天终结者
5楼-- · 2019-01-30 17:52

Add a hint to your code so that others will know your intent:

@SuppressWarnings("Duplicates")
查看更多
登录 后发表回答