تخطَّ إلى المحتوى

Repeated string literal (ARCH715)

هذا المحتوى غير متوفر بلغتك بعد.

Key dotnet.codequality.repeated-string-literal · Severity info · Category codequality

Flags a string literal of five or more characters used four or more times in one type. A value spelled out in several places drifts: one copy gets changed and the others do not. Attribute arguments, case labels, patterns, constant initialisers, log calls and seed data are not counted.

if (status == "awaiting-payment") ...
return "awaiting-payment";
log.Info("awaiting-payment");
filter.Add("awaiting-payment");
private const string AwaitingPayment = "awaiting-payment";
if (status == AwaitingPayment) ...
return AwaitingPayment;