WordPress-FluxC-Android icon indicating copy to clipboard operation
WordPress-FluxC-Android copied to clipboard

Fix CheckStyle Regex in relation to `RegexpMultiline` for Singleton Stores

Open ParaskP7 opened this issue 3 years ago • 0 comments

As part of https://github.com/wordpress-mobile/WordPress-FluxC-Android/pull/2491 and this change, a discussion was started as to whether the PluginCoroutineStore that was missing the @Singleton annotation should have it, just like the rest of the stores (as per the CheckStyle rule here).

Also, from that discussion, two more stores were identified with the same problem, the SiteOptionsStore and XPostsStore stores. The @Singleton annotation is missing there as well.

This issue is about fixing the RegexpMultiline CheckStyle rule and its regex so that it start reporting this violation not only for when the class and constructor are on the same line, but also, when those are split into two separate lines:

RegexpMultiline for Singleton Stores:

(?<!@Singleton)\n.*class \S*Store [^{]

Regex Working For:

class PluginCoroutineStore @Inject constructor(
    ...
) {
    ...
}

Regex Not Working For:

class PluginCoroutineStore
@Inject constructor(
    ...
) {
    ...
}

ParaskP7 avatar Aug 12 '22 10:08 ParaskP7