rspec/rules/S5850/python/rule.adoc

36 lines
367 B
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,python]
----
r"^a|b|c$"
----
=== Compliant solution
[source,python]
----
r"^(?:a|b|c)$"
----
or
[source,python]
----
r"^a$|^b$|^c$"
----
or, if you do want the anchors to only apply to ``a`` and ``c`` respectively:
[source,python]
----
r"(?:^a)|b|(?:c$)"
----