We target more advanced cases for the COBOL implementation of that rule where a complex condition is always true or false. In those cases, the solution is not to remove the whole condition but to either remove a sub-condition or change it. We would therefore need a dedicated description for COBOL.
https://github.com/google/error-prone/blob/master/docs/bugpattern/IsInstanceOfClass.md -> for me this one should have its own dedicated rule.
https://github.com/google/error-prone/blob/master/docs/bugpattern/SelfComparison.md -> this one should indeed probably be supported by SE engine in conjunction with the support of zero (cc [~michael.gumowski]
The message should be improved, as it is misleading. For example when the boolean expression is part of a chain of ``++OR++`` expressions, the subsequent code will be executed. Therefore _some subsequent code is never executed_ is misleading. (cc [~nicolas.harraudeau])
Example for csharp (which came in https://github.com/SonarSource/sonar-dotnet/issues/2411[issue #2411]). Although this specific example is rather an occurence of S2589 _Boolean expressions should not be gratuitous..._