AgodaAnalyzers
AgodaAnalyzers copied to clipboard
Improve the error message shown for AG0018:
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 I think we should expand our list of supported interfaces. Is there a list we maintain as allowed?
@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 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 I turned that into an issue #156 We can continue discussion there, or just create a PR :)