Skip to content

Commit

Permalink
Merge pull request #157 from inemtsev/Issue-156
Browse files Browse the repository at this point in the history
Issue-156: added IReadOnlyCollecton to allowed collections
  • Loading branch information
szaboopeeter authored Mar 3, 2021
2 parents 8a2214a + 91c6dd2 commit 67253b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Agoda.Analyzers.Test/AgodaCustom/AG0018UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class TestClass
[TestCase("IReadOnlyDictionary<string, int>")]
[TestCase("KeyedCollection<string, string>")]
[TestCase("IEnumerable<string>")]
[TestCase("IReadOnlyCollection<string>")]
[TestCase("IReadOnlyList<string>")]
public async Task AG0018_WithPermittedCollection_ShouldNotShowWarning(string type)
{
var code = $@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// </copyright>
using System.Collections.Immutable;
using System.Linq;
using System.Collections.Generic;
using Agoda.Analyzers.Helpers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
Expand All @@ -15,14 +16,16 @@ public class AG0018PermitOnlyCertainPubliclyExposedEnumerables : DiagnosticAnaly
{
public const string DIAGNOSTIC_ID = "AG0018";

private static readonly string[] AllowedTypes =
private static readonly HashSet<string> AllowedTypes = new HashSet<string>
{
"System.Collections.Generic.ISet<T>",
"System.Collections.Generic.IList<T>",
"System.Collections.Generic.IDictionary<TKey, TValue>",
"System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>",
"System.Collections.Generic.KeyedCollection<TKey, TValue>",
"System.Collections.Generic.IEnumerable<T>",
"System.Collections.Generic.IReadOnlyCollection<T>",
"System.Collections.Generic.IReadOnlyList<T>"
};

private static readonly LocalizableString Title = new LocalizableResourceString(
Expand Down

0 comments on commit 67253b5

Please sign in to comment.