Browse Source

feat: Enable Rules from 1826 to 1829

pull/9593/head
Giuseppe Lippolis 3 years ago
parent
commit
b23756e48f
  1. 8
      .editorconfig
  2. 4
      src/Avalonia.Controls/Selection/SelectionNodeBase.cs

8
.editorconfig

@ -145,6 +145,14 @@ dotnet_diagnostic.CA1820.severity = warning
dotnet_diagnostic.CA1821.severity = warning
# CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1825.severity = warning
# CA1826: Use property instead of Linq Enumerable method
dotnet_diagnostic.CA1826.severity = suggestion
# CA1827: Do not use Count/LongCount when Any can be used
dotnet_diagnostic.CA1827.severity = warning
# CA1828: Do not use CountAsync/LongCountAsync when AnyAsync can be used
dotnet_diagnostic.CA1828.severity = warning
# CA1829: Use Length/Count property instead of Enumerable.Count method
dotnet_diagnostic.CA1829.severity = warning
#CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = warning

4
src/Avalonia.Controls/Selection/SelectionNodeBase.cs

@ -290,12 +290,12 @@ namespace Avalonia.Controls.Selection
// so bail.
//
// See unit test Handles_Selection_Made_In_CollectionChanged for more details.
if (ItemsView is object &&
if (ItemsView is not null &&
RangesEnabled &&
Ranges.Count > 0 &&
e.Action == NotifyCollectionChangedAction.Add)
{
var lastIndex = Ranges.Last().End;
var lastIndex = Ranges[Ranges.Count - 1].End;
if (e.NewStartingIndex <= lastIndex)
{

Loading…
Cancel
Save