Find methods whose returns are all the same constant
ProprietaryMarks a method whose two or more return statements all yield the same constant: the same literal, null, enum constant, empty Optional or static final field of a primitive, wrapper or String type, directly or through a local variable that is never reassigned or whose value the enclosing if fixes, as in if (o == null) return o;. Either a branch is dead or one was meant to return another value. Returns inside lambdas and nested classes are not counted. Overrides, Void methods, Spring MVC handlers, Struts ActionForward actions and test sources are skipped.
io. moderne. staticanalysis. FindInvariantMethodReturnmod run . --recipe= io. moderne. staticanalysis. FindInvariantMethodReturnInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.