Page MenuHomePhabricator

Codesniffer should be updated to support telling when to error out because a setting lacks a wg prefix
Closed, ResolvedPublic

Description

Hi when running composer test it errors out and says this setting lacks wg prefix. But this setting should have wg since it is for the path to the extension for example timedmediahandler $timedMediaDir which has the DIR set. It should only show that error if it isent setting DIR.

I am not sure if this is done on purpose or if it should change but same goes for mediawiki core when setting $IP which has been like that for a long time and would break anything if it is changed.

Event Timeline

Paladox raised the priority of this task from to Needs Triage.
Paladox updated the task description. (Show Details)
Paladox added a project: MediaWiki-Codesniffer.
Paladox subscribed.
Paladox claimed this task.
Paladox added a subscriber: Legoktm.

Adding @Legoktm per he said I could add him to code sniffer tasks.

Paladox set Security to None.

@Paladox, I'm not sure I understood the issue correctly. Is this to do with the fact that there are certain global variables without a wg prefix that codesniffer should not complain about?

If that's the case, take a look at core's phpcs.xml, line 11 where you'll find the following:

<rule ref="MediaWiki.NamingConventions.ValidGlobalName">
  <properties>
    <property name="ignoreList" type="array" value="$IP,$messageMemc,$parserMemc" />
  </properties>
</rule>

$IP, for example, has been added to the ignoreList of MediaWiki.NamingConventions.ValidGlobalName. Would doing something similar solve the issue here?

Could $IP be added to the global ignore list so extensions and skins doint have to add it to each skin and extension please.

Umherirrender subscribed.

Needed extension already have $IP in it own phpcs.xml ignore list,
so using the extension level instead of a global level sounds enough to me