37 lines
820 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
During dictionary use, it is normal that you might want to replace the value associated with one of the dictionary's keys. But do so during the initial definition of a dictionary, and you've probably made an error.
This rule raises an issue when the same key is used multiple times in the initial definition of a dictionary.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
fruit = {"apple":4, "pear":6, "quince":29, "apple": 8} # Noncompliant; "apple" is used in positions 0 and 3
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
fruit = {"apple":4, "pear":6, "quince":29, "potato": 8}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
"xxx" is used in positions n, o, p...
endif::env-github,rspecator-view[]