Page MenuHomePhabricator

MediaWiki-Codesniffer sniffs the .git folder
Closed, ResolvedPublic

Description

Since mw codesniffer 0.5.1 has been released it has been sniffing the .git folder as it did at https://gerrit.wikimedia.org/r/#/c/248379/

It should not be doing that since the .git folder only has information for the git programme.

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.
Aklapper renamed this task from Bug in MW codesniffer 0.5.1 now sniffs the .git folder to Codesniffer 0.5.1 now sniffs the .git folder.Jan 4 2016, 3:57 AM

Is this an upstream change...? We didn't change anything in mw-cs I think...

Hmm, I can't reproduce:

km@km-tp ~/p/v/m/e/AbsenteeLandlord> ./vendor/bin/phpcs -v 
Registering sniffs in the  standard... DONE (54 sniffs registered)
Creating file list... DONE (1 files in queue)
Changing into directory /home/km/projects/vagrant/mediawiki/extensions/AbsenteeLandlord
Processing AbsenteeLandlord.php [PHP => 410 tokens in 58 lines]... DONE in 14ms (0 errors, 0 warnings)

Oh, no. I just had to create a .php file inside .git:

km@km-tp ~/p/s/AbsenteeLandlord> ./vendor/bin/phpcs -v
Registering sniffs in the  standard... DONE (54 sniffs registered)
Creating file list... DONE (2 files in queue)
Changing into directory /home/km/projects/sandbox/AbsenteeLandlord
Processing AbsenteeLandlord.php [PHP => 410 tokens in 58 lines]... DONE in 13ms (0 errors, 0 warnings)
Changing into directory /home/km/projects/sandbox/AbsenteeLandlord/.git
Processing test.php [PHP => 0 tokens in 0 lines]... DONE in 0ms (0 errors, 1 warnings)

After further testing, it appears this isn't a new problem to 0.5.1. I can reproduce this issue going all the way back to 0.1.0.

Legoktm renamed this task from Codesniffer 0.5.1 now sniffs the .git folder to MediaWiki-Codesniffer sniffs the .git folder.Jan 19 2016, 7:39 AM

I'm guessing we just need to add it to the ignored patterns in phpcs.xml?

Sorry, while phpcs.xml works for individual repositories, we should probably be changing this in ruleset.xml using <exclude-pattern> I think.

Change 362266 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/tools/codesniffer@master] Exclude common folder

https://gerrit.wikimedia.org/r/362266

Change 362266 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Exclude common folders

https://gerrit.wikimedia.org/r/362266

Umherirrender claimed this task.
Umherirrender triaged this task as Medium priority.