wikimedia / banana-checker

Development has moved to Wikimedia GitLab
https://gitlab.wikimedia.org/repos/ci-tools/banana-checker/
MIT License
8 stars 4 forks source link

Make default banana-checker configuration more suitable to MediaWiki extensions & skins #86

Open legoktm opened 4 years ago

legoktm commented 4 years ago

For most MediaWiki extensions, we currently parse extension.json to get the value of MessagesDirs, and then pass that onto banana-checker. I think we should move this logic into banana-checker itself, which provides the following benefits:

I don't know if we're ok with an implicit/magic read from extension.json or skin.json if it exists, or whether we'd have an explicit options: { from: 'extension.json' } or something...either would be fine IMO.

Krinkle commented 4 years ago

I'd rather not hardcoded for MW specifically, but I think there's a simpler way that meets our needs.

We can point banana-checker directly at i18n/. There's generally only one such directory anyway. We can have it crawl subdirectories and treat those as their own message domain as well. And we could support an array (JS) and/or multiple variadic arguments (CLI) for when they reside in entirely distinct top-level directories (e.g. not just i18n/foo and i18n/bar, but i18n/ and foobar/i18n).

Avoid use of Object.assign that eslint complains about

It complains because someone's misconfigured ESLint on that file. This method isn't available in ES6, and in that repo the file is declared as running in ES6 or later.

legoktm commented 4 years ago

Uh, that's perfect. Even just adding recursive support would be good enough. I checked through all of Gerrit and the only repos that don't have all the i18n in one top-level folder are:

So yes, if we recurse through the configured directory and default it to i18n/ that would take care of 99% of our repos.