From 7c4600052700668f78a6595f9477618ca2c0ed5a Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 3 Feb 2014 10:01:19 -0800 Subject: [PATCH] Permanently remove license linters Summary: For eventual commit. Test Plan: none Reviewers: nh, btrahan Reviewed By: btrahan CC: aran, vrana, FacebookPOC Maniphest Tasks: T2274 Differential Revision: https://secure.phabricator.com/D4907 --- src/__phutil_library_map__.php | 4 -- .../linter/ArcanistApacheLicenseLinter.php | 51 ---------------- src/lint/linter/ArcanistLicenseLinter.php | 59 ------------------- 3 files changed, 114 deletions(-) delete mode 100644 src/lint/linter/ArcanistApacheLicenseLinter.php delete mode 100644 src/lint/linter/ArcanistLicenseLinter.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 11212cee..cc104691 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -13,7 +13,6 @@ phutil_register_library_map(array( 'ArcanistAliasWorkflow' => 'workflow/ArcanistAliasWorkflow.php', 'ArcanistAmendWorkflow' => 'workflow/ArcanistAmendWorkflow.php', 'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php', - 'ArcanistApacheLicenseLinter' => 'lint/linter/ArcanistApacheLicenseLinter.php', 'ArcanistArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistArcanistLinterTestCase.php', 'ArcanistBackoutWorkflow' => 'workflow/ArcanistBackoutWorkflow.php', 'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php', @@ -86,7 +85,6 @@ phutil_register_library_map(array( 'ArcanistJSHintLinter' => 'lint/linter/ArcanistJSHintLinter.php', 'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php', 'ArcanistLiberateWorkflow' => 'workflow/ArcanistLiberateWorkflow.php', - 'ArcanistLicenseLinter' => 'lint/linter/ArcanistLicenseLinter.php', 'ArcanistLintConsoleRenderer' => 'lint/renderer/ArcanistLintConsoleRenderer.php', 'ArcanistLintEngine' => 'lint/engine/ArcanistLintEngine.php', 'ArcanistLintJSONRenderer' => 'lint/renderer/ArcanistLintJSONRenderer.php', @@ -192,7 +190,6 @@ phutil_register_library_map(array( 'ArcanistAliasWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow', - 'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter', 'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase', 'ArcanistBackoutWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase', @@ -247,7 +244,6 @@ phutil_register_library_map(array( 'ArcanistJSHintLinter' => 'ArcanistLinter', 'ArcanistLandWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow', - 'ArcanistLicenseLinter' => 'ArcanistLinter', 'ArcanistLintConsoleRenderer' => 'ArcanistLintRenderer', 'ArcanistLintJSONRenderer' => 'ArcanistLintRenderer', 'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer', diff --git a/src/lint/linter/ArcanistApacheLicenseLinter.php b/src/lint/linter/ArcanistApacheLicenseLinter.php deleted file mode 100644 index fbed31cc..00000000 --- a/src/lint/linter/ArcanistApacheLicenseLinter.php +++ /dev/null @@ -1,51 +0,0 @@ - 'No License Header', - ); - } - - abstract protected function getLicenseText($copyright_holder); - abstract protected function getLicensePatterns(); - - public function lintPath($path) { - $copyright_holder = $this->getConfig('copyright_holder'); - if ($copyright_holder === null) { - $config = $this->getEngine()->getConfigurationManager(); - $copyright_holder = $config->getConfigFromAnySource('copyright_holder'); - } - - if (!$copyright_holder) { - return; - } - - $patterns = $this->getLicensePatterns(); - $license = $this->getLicenseText($copyright_holder); - - $data = $this->getData($path); - $matches = 0; - - foreach ($patterns as $pattern) { - if (preg_match($pattern, $data, $matches)) { - $expect = rtrim(implode('', array_slice($matches, 1)))."\n".$license; - if (trim($matches[0]) != trim($expect)) { - $this->raiseLintAtOffset( - 0, - self::LINT_NO_LICENSE_HEADER, - 'This file has a missing or out of date license header.', - $matches[0], - ltrim($expect)); - } - break; - } - } - } -}