Disallow Java "assert" keyword

SonarQube: 8.9.1

We would like to enforce a rule to disallow the Java built-in assert keyword, but see no way to do this. S1190 is the closest I can find, but does not seem to apply to the assert keyword.

I did try to create an XPath rule using the PMD plugin, but I was not able to get this to match.

Does anybody have any good solutions for disallowing asserts?

Hey @mike12489,

Indeed, there is no rule in the current version of the analyzer that would do exactly this.
If RSPEC-4274 is not sufficient, you can take a look at building your own custom rule in Java by taking inspiration from the original check itself.

Cheers,

Dorian