rspec/rules/S5612/java/rule.adoc

43 lines
937 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Lambdas (introduced with Java 8) are a very convenient and compact way to inject a behavior without having to create a dedicated class or method. But those lambdas should be used only if the behavior to be injected can be defined in a few lines of code, otherwise the source code can quickly become unreadable.
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Reduce this lambda number of lines from {} to at most {}, or make it a named class or method.
=== Parameters
.Max
****
----
20
----
Maximum allowed lines of code in a lambda
****
'''
== Comments And Links
(visible only on this page)
=== relates to: S1188
=== on 7 Nov 2019, 15:19:40 Michael Gumowski wrote:
Splitting RSPEC-1188 for java in two distinct rules:
* RSPEC-1188 targets ONLY anonymous classes
* RSPEC-5612 targets ONLY lambdas
endif::env-github,rspecator-view[]