简体   繁体   中英

Intellij, disable inspection/suggestion only for file

It's annoying and attention grabbing when Intellij will highlight all kinds of stuff like simplify something or a suggestion, or a warning of some kind.

Many times, I like the thank you mam, but stop bothering me. This is not relevant.

However, Intellij will only allow you to ignore the type of warning globally, which is kind of dangerous to do.

I am aware that you can add an annotation, but I don't want to pollute my classes with annotations and comments everywhere. Also, @SuppressWarnings("ALL") is applied even suggestions, not even on warnings.

Can't Intellij manage this using a project file ? Also, Intellij should add a line to the right to show where such a supression has been done.

Problem right now, is that once you supress globally it's almost impossible to undo, or revise.

I mean @SuppressWarnings({"PointlessBooleanExpression", "ConstantConditions"}) is hardly Java related, and should not be added to the code.

It should be managed by the editor. It must also be made so that it's easily editable and an overview can be seen for the entire project files.

Is this possible already?

If enabled in the settings somewhere, you can use //@formatter:off to turn off formatter and //@formatter:on to turn on formatter. Afaik it requires that you turn on the formatter before the end of the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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