rspec/rules/S6395/java/rule.adoc
2022-05-09 08:48:55 +02:00

28 lines
424 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
[source,java]
----
"(?:number)\\d{2}"
----
== Compliant Solution
[source,java]
----
"number\\d{2}" // it is anyway required
"(?:number)?\\d{2}" // it is in fact optional
----
== Exceptions
This rule does not report an issue if the non-capturing group is an alternation.
[source,java]
----
"(?:number|string)"
----
include::../implementation.adoc[]