java:S6212 please add an option to ignore primitive data types

Please add an option to allow ignoring primitive data types to this rule java:S6212 " Local-Variable Type Inference should be used". The eight primitives defined in Java are int, byte, short, long, float, double, boolean and char

Hi @PowerStat,

Welcome to the community!

First a question, is there a specific reason why you don’t want to disable the rule? I think it is a quite controversial rule and it is not included in the default profile.

Dear Erwan,

for myself I don’t care about default profiles - I made my own decision about every available rule - but thats not the point.
As you said the rule is controversial - and for me the controverse lies in the point that the rule makes (for me) no sense when using it on primitive datatypes.
So an option to switch off it only for the primitive datatypes will make (for me) the rule more usable. Because the rules makes sense for me when using with user defined datatypes (classes).

Hi Kai,

Could you provide examples where you think using var makes no sense for primitive types? I want to better understand the problem. For instance, for me, it is perfectly fine to do:

var x = 10;

For some background, we removed the rule from the default profile, because there was too much FP.