Allow S4261 to include custom allowed suffixes for async methods

In a project I’m working on we have a rule for method naming that enforces private methods to be suffixed with _. rule S4261 (MethodShouldBeNamedAccordingToSynchronicity) enforces all async methods to be named with the suffix “Async”. I would like to add aditional suffixes that validate the async method name, in my case “Async_”.

hi @MikaelBertze, welcome to this community!

This particular use case sounds very specific to your code base. We usually avoid adding parameters to our rules, unless it makes sense for most users, due to the maintenance overhead.

However, if more people will vote for this, we may take into consideration customizing the rule.

Until then, you can write your own analyzer, and get some inspiration from our implementation. Issues from third party analyzers, when referenced in your project, are automatically imported by the SonarScanner for MSBuild.