This rule raises an issue when the same value is used multiple times when instantiating a set literal.
By definition, a set cannot hold the same value multiple times. When instantiating a set literal with the same value repeated multiple times, only the last occurrence of the duplicated value will remain.
Creating a set with redundant elements is prone to errors and confusion. A duplicated value in a set literal should be either:
{"one", "two", "one"} # Noncompliant: the value "one" is duplicated.
def func(a1, a2, a3):
{a1, a2, a1} # Noncompliant: the value a1 is duplicated.
{"one", "two", "three"}
def func(a1, a2, a3):
{a1, a2, a3}