Примеры ошибок, обнаруженных с помощью диагностики V3081
V3081. The 'X' counter is not used inside a nested loop. Consider inspecting usage of 'Y' counter.
Entity Framework
V3081 The 'j' counter is not used inside a nested loop. Consider inspecting usage of 'i' counter. EFCore.Specification.Tests ComplexNavigationsQueryTestBase.cs 2393
for (var i = 0; i < result.Count; i++)
{
var expectedElement = expected
.Single(e => e.Name == result[i].Name);
var expectedInnerNames = expectedElement
.OneToMany_Optional.Select(e => e.Name)
.ToList();
for (var j = 0; j < expectedInnerNames.Count; j++) // <=
{
Assert.True
(
result[i]
.OneToMany_Optional.Select(e => e.Name)
.Contains(expectedInnerNames[i]) // <=
);
}
}
Infer.NET
V3081 The 'r' counter is not used inside a nested loop. Consider inspecting usage of 'c' counter. CommandLine ClassifierEvaluationModule.cs 459
private void WriteAucMatrix(....)
{
....
for (int c = 0; c < classLabelCount; c++)
{
int labelWidth = labels[c].Length;
columnWidths[c + 1] =
labelWidth > MaxLabelWidth ? MaxLabelWidth : labelWidth;
for (int r = 0; r < classLabelCount; r++)
{
int countWidth = MaxValueWidth;
if (countWidth > columnWidths[c + 1])
{
columnWidths[c + 1] = countWidth;
}
}
....
}