microsoft/tslint-microsoft-contrib

validate-private-statics-as-either skips some names and needs tests

JoshuaKGoldberg opened this issue · 2 comments

In working on migrating function-name tests as part of #489, I noticed that the test cases for options such as validate-private-statics-as-either don't test that the rule gives complaints when those options are enabled. Seems like a gap in test coverage.

Anybody is welcome to tackle this! 😊

These tests would actually fail, because of the incorrect logic introduced in PR #501, which added the private static options.

Currently, at most only 1 method rule will be validated, but the option "validate-private-statics-as-either" intends to consider a private/protected static method name valid if either the private/protected or static validations pass (based on the test data). It actually ends up not doing any validation on private static methods.

Further, when "validate-private-statics-as-static" is specified, it also will not run any validation on private/protected static method names.

Related to issue #786. This functionality should probably just be changed to either prioritize static validations or have clearer options.

I am addressing the basics of this in PR #877.

Ha, fantastic catch @arinwt!

This is something of a breaking change, but since it's a bug of a lesser-used option of a naming rule, I think it's fine to include in a minor version change.