mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01: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:
parent
f22d74f88d
commit
e0bc910dda
3 changed files with 5 additions and 4 deletions
0
foo.bar
0
foo.bar
|
@ -25,6 +25,7 @@ class ArcanistApacheLicenseLinter extends ArcanistLicenseLinter {
|
|||
$year = date('Y');
|
||||
|
||||
return <<<EOLICENSE
|
||||
|
||||
/*
|
||||
* Copyright {$year} {$copyright_holder}
|
||||
*
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue