1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 00:49:11 +02:00

Tweak license linter to support licenses on line immediately after <?php

Summary:
Tweak license linter to support licenses on line immediately after <?php

Test Plan:
Corrupt an apache license and re-lint twice.

Differential Revision: 34
Reviewed By: epriestley
Reviewers: epriestley
This commit is contained in:
adonohue 2011-02-11 17:48:06 -08:00
parent f22d74f88d
commit e0bc910dda
3 changed files with 5 additions and 4 deletions

View file

View file

@ -25,6 +25,7 @@ class ArcanistApacheLicenseLinter extends ArcanistLicenseLinter {
$year = date('Y');
return <<<EOLICENSE
/*
* Copyright {$year} {$copyright_holder}
*

View file

@ -56,12 +56,12 @@ abstract class ArcanistLicenseLinter extends ArcanistLinter {
$patterns = $this->getLicensePatterns();
$license = $this->getLicenseText($copyright_holder);
$data = $this->getData($path);
$matches = 0;
foreach ($patterns as $pattern) {
$data = $this->getData($path);
$matches = 0;
if (preg_match($pattern, $data, $matches)) {
$expect = rtrim(implode('', array_slice($matches, 1)))."\n\n".$license;
$expect = ltrim($expect);
$expect = rtrim(implode('', array_slice($matches, 1)))."\n".$license;
if (rtrim($matches[0]) != rtrim($expect)) {
$this->raiseLintAtOffset(
0,