wikibase-codesniffer uses mediawiki-codensiffer
mediawiki-codensiffer has advanced quite some since wikibase-codesniffer was created.
Perhaps we can stop maintaining a separate thing and instead just use mediawiki-codesniffer directly.
wikibase-codesniffer uses mediawiki-codensiffer
mediawiki-codensiffer has advanced quite some since wikibase-codesniffer was created.
Perhaps we can stop maintaining a separate thing and instead just use mediawiki-codesniffer directly.
An example of how the extra level of indirection creates overhead will be seen in DataModel soon, where:
There are possibly other ways to solve this than just removing wikibase-codesniffer entirely, but I believe the evaluation should determine if we actually need it / what we currently gain from it
I honestly think we should just drop wikibase codesniffer. We have been maintaining too much codebase.
Note that phpcs ruleset is controllable per repository. The same way that we disable some rules in repositories not yet ready to follow a newer convention, it is also possible to enable additional rules on a per-repo bases.
So these rulesets could easily be put into the phpcs files of the repositories in question directly. If there are also PHP classes involved, we could ship those in mediawiki-codesniffer as off by default.
If none of that's needed, that's obviously even better, but if it helps kick-start this transition, I think that would be fine :)
I think the reason back then was that wikibase team maintains lots of repos instead of one or two (which is another can of worms) and if we want to, for example, enforce a different rule for our codebase, we have to change all phpcs files one by one.
My solution to this is to actually merge back libraries to our repos, which we has done in one or two cases already.
I think we could solve that with a package anyway (having it use a hook to write a file into the correct place).
But having these rules that synced I believe is undesired.
Related: T164653: Review rules in wikibase/wikibase-codesniffer and see which are appropriate for MW-CS
I've suggested this elsewhere, but as a start, I think we can move the Wikibase ruleset into the mediawiki-codesniffer package, so we no longer need to maintain an extra dependent package in the middle. Wikibase repos would continue to point at the Wikibase ruleset via .phpcs.xml. This also would make changes to the MediaWiki ruleset immediately available to Wikibase repos. And then it should be more straightforward to merge stuff from the Wikibase ruleset into the main MediaWiki one, eventually sunsetting Wikibase.
Related tickets:
Back in 2017 I had multiple reasons to push for a custom rule set. Many of them are not valid any more:
Reviewing some individual customizations:
This leaves only a few things:
TL;DR: I suggest to archive the WikibaseCodeSniffer.
So looking at the great analysis from @thiemowmde it looks like we could / should in order to be in the best position to get rid of wikbase-codesniffer:
I'll try and remember to bring this up in one of our next tech prioritization meetings
I just +2ed the last change mentioned in my above comment.
Which means we should be able to actually retire wikibase-codensiffer after the next release, which will either be v33 or v32.1