rspec/rules/S4274/description.adoc
Arseniy Zaostrovnykh 7ca29f686f Force linebreaks
2021-02-02 15:02:10 +01:00

5 lines
573 B
Plaintext

An ``++assert++`` is inappropriate for parameter validation because assertions can be disabled at runtime in the JVM, meaning that a bad operational setting would completely eliminate the intended checks. Further, ``++assert++``s that fail throw ``++AssertionError++``s, rather than throwing some type of ``++Exception++``. Throwing ``++Error++``s is completely outside of the normal realm of expected ``++catch++``/``++throw++`` behavior in normal programs.
This rule raises an issue when a ``++public++`` method uses one or more of its parameters with ``++assert++``s.