Made by DeepSource

Consider using the @targetName() annotation for symbol-like methods SC-R1068


In Scala, method names do not have to be limited to words and can take symbol-like values such as ::, ++, and so on. Scala 3 introduces an annotation called @targetName() that specifies an alternate name for the method. While the actual name of the method remains unchanged, this annotation helps provide context to what the method is doing and may improve the overall readability.

Bad Practice

def ++=[T](elems: Array[T]): Array[T] = ...


// The targetName annotation helps the reader understand that this
// method appends elements to the buffer.
def ++=[T](elems: Array[T]): Array[T] = ...