rspec/rules/S5857/description-jvm.adoc
2022-02-04 16:28:24 +00:00

39 lines
612 B
Plaintext

include::description.adoc[]
== Noncompliant Code Example
[source,text]
----
<.+?>
".*?"
----
== Compliant Solution
[source,text]
----
<[^>]++>
"[^"]*+"
----
or
[source,text]
----
<[^>]+>
"[^"]*"
----
== Exceptions
This rule only applies in cases where the reluctant quantifier can easily be replaced with a negated character class. That means the repetition has to be terminated by a single character or character class. Patterns such as the following, where the alternatives without reluctant quantifiers are more complicated, are therefore not subject to this rule:
----
<!--.*?-->
/\*.*?\*/
----