AgodaAnalyzers icon indicating copy to clipboard operation
AgodaAnalyzers copied to clipboard

Improve the error message shown for AG0018:

Open szaboopeeter opened this issue 4 years ago • 4 comments

The message shown when AG0018 is violated is quite confusing:

Ensure that publicly exposed IEnumerable types

This PR will change it to the following:

Invalid return type. Publicly exposed enumerable types must be on our whitelist.

Also updated some inconsistencies in how this rule is referred to in other places.

Fixes #149

szaboopeeter avatar Feb 10 '21 03:02 szaboopeeter

@szaboopeeter I think we should expand our list of supported interfaces. Is there a list we maintain as allowed?

inemtsev avatar Feb 18 '21 05:02 inemtsev

@inemtsev It's an option, but I wouldn't couple it together with this PR. I suggest to open an issue if you wanna have a discussion over GH. The list of supported interfaces is here in code (plus byte array, the check for that is a bit messy, but you can find it in the same file): https://github.com/agoda-com/AgodaAnalyzers/blob/5f80f52fa3f7b4aea8e9d8252966ca9cedf9896f/src/Agoda.Analyzers/AgodaCustom/AG0018PermitOnlyCertainPubliclyExposedEnumerables.cs#L18-L26, it's based on docs: https://github.com/agoda-com/standards-c-sharp/blob/master/docs/collections/choosing-collection-implementation.md#supported-types

szaboopeeter avatar Feb 18 '21 06:02 szaboopeeter

@szaboopeeter Our team, would like to use IReadOnlyCollection<> which results in quite a bit of warnings. I can update the docs if we agree to allow this.

inemtsev avatar Mar 01 '21 09:03 inemtsev

@inemtsev I turned that into an issue #156 We can continue discussion there, or just create a PR :)

szaboopeeter avatar Mar 02 '21 02:03 szaboopeeter