Help remove unused wmf-config code

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Help remove unused wmf-config code

Krinkle
TL;DR:
Check https://wikitech.wikimedia.org/wiki/User:Krinkle/Unused_config and
help remove variables.


Hi,

I wrote a script to detect unused wmf-config code. [1] Specifically, unused
settings and conditional blocks for configuration that no longer exists in
MediaWiki.

The script cross-references any wg- identifiers in wmf-config with
Legoktm's Codesearch tool [2] and reports those that have no matches
outside wmf-config. [1]

I've submitted and deployed a few patches already. [3]

Check out the list of matches at <
https://wikitech.wikimedia.org/wiki/User:Krinkle/Unused_config>.

Look for ones relevant to your area of expertise, and confirm that they're
unused, then submit patches for their removal. You can enlist them for
SWAT, or use the tag "cleanup" and I or others may deploy them for you.

I'll run the script again sometime later, but in the mean time, feel free
to edit the page to strike-out or remove entries that you've dealt with.

Best,
-- Krinkle

[1] Source code:
https://gist.github.com/Krinkle/15be368abdbf918c8ef7a06cde011457

[2] https://codesearch.wmflabs.org/search/

[3]
Merged patches:
https://gerrit.wikimedia.org/r/#/q/project:operations/mediawiki-config+topic:cleanup+is:merged
Open for review:
https://gerrit.wikimedia.org/r/#/q/project:operations/mediawiki-config+topic:cleanup+is:open
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Help remove unused wmf-config code

Stas Malyshev
Hi!

> I wrote a script to detect unused wmf-config code. [1] Specifically, unused
> settings and conditional blocks for configuration that no longer exists in
> MediaWiki.
>
> The script cross-references any wg- identifiers in wmf-config with
> Legoktm's Codesearch tool [2] and reports those that have no matches
> outside wmf-config. [1]

I checked the CirrusSearch ones and most are indeed unused, except that
this one: CirrusSearchCrossProjectBlockScoreProfiles - seems to have a
mention as CirrusSearchCrossProjectBlockScorerProfiles - I wonder if
it's a typo.
Generally CirrusSearch uses some configs without 'wg' prefix, but in
this case it doesn't seem to be an issue.

> Open for review:
> https://gerrit.wikimedia.org/r/#/q/project:operations/mediawiki-config+topic:cleanup+is:open

This one produces 404.

--
Stas Malyshev
[hidden email]

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Help remove unused wmf-config code

Gergo Tisza
On Sun, Jul 8, 2018 at 5:41 AM Stas Malyshev <[hidden email]>
wrote:

> > Open for review:
> >
> https://gerrit.wikimedia.org/r/#/q/project:operations/mediawiki-config+topic:cleanup+is:open
>
> This one produces 404.
>

Unfortunately search URLs are not compatible between the old and new Gerrit
interface. The Polygerrit equivalent for this one is
https://gerrit.wikimedia.org/r/q/project:operations%252Fmediawiki-config+topic:cleanup+is:open
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Help remove unused wmf-config code

Adam Wight-2
Strange--the "UseContributionTracking" variable is still a thing, although
it's reported as unused by the script.  See
https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/CommonSettings.php#L2098

I get correct results when querying manually:
https://codesearch.wmflabs.org/search/api/v1/search?repos=*&rng=:20&i=nope&files=&q=(\%27|%22|wg)UseContributionTracking

Donno why it's showing up as unused.

-Adam



On Sun, Jul 8, 2018 at 7:07 PM Gergo Tisza <[hidden email]> wrote:

> On Sun, Jul 8, 2018 at 5:41 AM Stas Malyshev <[hidden email]>
> wrote:
>
> > > Open for review:
> > >
> >
> https://gerrit.wikimedia.org/r/#/q/project:operations/mediawiki-config+topic:cleanup+is:open
> >
> > This one produces 404.
> >
>
> Unfortunately search URLs are not compatible between the old and new Gerrit
> interface. The Polygerrit equivalent for this one is
>
> https://gerrit.wikimedia.org/r/q/project:operations%252Fmediawiki-config+topic:cleanup+is:open
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Help remove unused wmf-config code

Krinkle
On Sun, Jul 8, 2018 at 12:49 PM, Adam Wight <[hidden email]> wrote:

> Strange--the "UseContributionTracking" variable is still a thing, although
> it's reported as unused by the script.  See
> https://github.com/wikimedia/operations-mediawiki-config/
> blob/master/wmf-config/CommonSettings.php#L2098
>
> I get correct results when querying manually:
> https://codesearch.wmflabs.org/search/api/v1/search?
> repos=*&rng=:20&i=nope&files=&q=(\%27|%22|wg)UseContributionTracking
>
>
The script looks for wg* variables assigned or read in wmf-config that
yield no
search results in any other Wikimedia git repo.

Normally, when a wg variable is assigned in wmf-config it is to set it to a
certain value, to be consumed by MediaWiki core (or an extension).

In the case of wgUseContributionTracking, it is not a MediaWiki setting.
Rather, it is an internal setting created in wmf-config/CommonSettings,
solely for to be used
in wmf-config/InitialiseSettings.php.

The concept of temporary variables internal to wmf-config is quite common.
However, the script
won't (and shouldn't) find those normally because those variables are
conventionally prefixed "wmg",
instead of "wg". But, the ContributionTracking setting uses the "wg"
prefix. Hence, the false positive
because this is a "wg" setting referenced exclusively within wmf-config.

-- Timo
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l