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 created this task.Oct 17 2015, 11:54 AM
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 added a subscriber: Paladox.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 17 2015, 11:54 AM
Paladox closed this task as Resolved.Oct 17 2015, 11:55 AM
Paladox claimed this task.
Paladox added a subscriber: Legoktm.

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

Paladox removed Paladox as the assignee of this task.Oct 17 2015, 11:55 AM
Paladox set Security to None.
JohnLewis reopened this task as Open.Oct 17 2015, 11:59 AM
JohnLewis added a subscriber: JohnLewis.

Accidental close?

@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 closed this task as Resolved.Sep 24 2017, 2:28 PM
Umherirrender added a subscriber: Umherirrender.

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