Check the following code:
class Noncompliant
{
public void UseSuffixForLiterals()
{
var d0 = (decimal)12.0; // Noncompliant, use 12.0m
var d1 = (decimal)12; // Noncompliant, use 12m
var d2 = (double)12; // Noncompliant, use 12d
var f0 = (float)12.0; // Noncompliant, use 12.0f
var n0 = (uint)12; // Noncompliant, use 12u
var n1 = (long)12; // Noncompliant, use 12l
var n2 = (ulong)12; // Noncompliant, use 12ul
}
}
I think S1905 should report on this too, ideally with a code fix.
I assume this is also applicable for Java and C++, and there might be other stongly typed languages that you support where this is possible.
Tested with SonarAnalyzer.CSharp v10.7.0.110445