Code inspection patterns regarding namespaces


I would like to add ReSharper code inspection patterns regarding namespaces.

Two examples that spring to mind:

Rule 1: Do not add "using (specific_namespace);" to the code at all (it is provided by a third-party library and we do not want to use the helper methods in that namespace).

Rule 2: Do not add "using (namespace).Internal;" to files that are not in "namespace (namespace)", as files from other namespaces should only use the public interfaces, not the internal implementations.

However, it seems ReSharper does not support such patterns, I always get the error "Pattern is ambiguous", e.g. when trying the pattern

using $identifier1$.Internal;

namespace $identifier2$

The ReSharper versions I tried are 2019.3.2 and 2019.3.3.

Am I doing it wrong or is this unsupported? If unsupported, can support be considered? Or do you know other tools that can achieve this?

Please sign in to leave a comment.