Search code examples
stylecop

Correcting spelling rule in StyleCop


StyleCop rule SA1642 insists that my documentation header for constructors must begin with 'Initializes a new instance of...'.

Whereas I agree with the rule itself, I just can't bring myself to accept StyleCop enforcing spellings I consider ugly. It's 'initialises' with an 's'!!!

Is it possible to modify the expected text, or must I simply disable a sensible rule?


Solution

  • Current StyleCop version doesn't support customization for documentation rules. And there are no short-term plans to support it.

    As a possible workaround (instead of disabling the entire rule) you could refer to some third-party custom rules. For example, StyleCop+ currently allows writing "Initializes a new instance." as well as "Initializes a new instance of the Class1 class."

    So I guess it could be extended to also allow "Initialises ...". But if you want to force "Initialises" and prohibit "Initializes" it seems you need to wait for customizable documentation rules support.