mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 18:22:41 +01:00
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
This commit is contained in:
parent
114bb9f25b
commit
7c46000527
3 changed files with 0 additions and 114 deletions
|
@ -13,7 +13,6 @@ phutil_register_library_map(array(
|
||||||
'ArcanistAliasWorkflow' => 'workflow/ArcanistAliasWorkflow.php',
|
'ArcanistAliasWorkflow' => 'workflow/ArcanistAliasWorkflow.php',
|
||||||
'ArcanistAmendWorkflow' => 'workflow/ArcanistAmendWorkflow.php',
|
'ArcanistAmendWorkflow' => 'workflow/ArcanistAmendWorkflow.php',
|
||||||
'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
|
'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
|
||||||
'ArcanistApacheLicenseLinter' => 'lint/linter/ArcanistApacheLicenseLinter.php',
|
|
||||||
'ArcanistArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistArcanistLinterTestCase.php',
|
'ArcanistArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistArcanistLinterTestCase.php',
|
||||||
'ArcanistBackoutWorkflow' => 'workflow/ArcanistBackoutWorkflow.php',
|
'ArcanistBackoutWorkflow' => 'workflow/ArcanistBackoutWorkflow.php',
|
||||||
'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php',
|
'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php',
|
||||||
|
@ -86,7 +85,6 @@ phutil_register_library_map(array(
|
||||||
'ArcanistJSHintLinter' => 'lint/linter/ArcanistJSHintLinter.php',
|
'ArcanistJSHintLinter' => 'lint/linter/ArcanistJSHintLinter.php',
|
||||||
'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php',
|
'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php',
|
||||||
'ArcanistLiberateWorkflow' => 'workflow/ArcanistLiberateWorkflow.php',
|
'ArcanistLiberateWorkflow' => 'workflow/ArcanistLiberateWorkflow.php',
|
||||||
'ArcanistLicenseLinter' => 'lint/linter/ArcanistLicenseLinter.php',
|
|
||||||
'ArcanistLintConsoleRenderer' => 'lint/renderer/ArcanistLintConsoleRenderer.php',
|
'ArcanistLintConsoleRenderer' => 'lint/renderer/ArcanistLintConsoleRenderer.php',
|
||||||
'ArcanistLintEngine' => 'lint/engine/ArcanistLintEngine.php',
|
'ArcanistLintEngine' => 'lint/engine/ArcanistLintEngine.php',
|
||||||
'ArcanistLintJSONRenderer' => 'lint/renderer/ArcanistLintJSONRenderer.php',
|
'ArcanistLintJSONRenderer' => 'lint/renderer/ArcanistLintJSONRenderer.php',
|
||||||
|
@ -192,7 +190,6 @@ phutil_register_library_map(array(
|
||||||
'ArcanistAliasWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistAliasWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
|
|
||||||
'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
|
'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
|
||||||
'ArcanistBackoutWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistBackoutWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
|
'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
|
||||||
|
@ -247,7 +244,6 @@ phutil_register_library_map(array(
|
||||||
'ArcanistJSHintLinter' => 'ArcanistLinter',
|
'ArcanistJSHintLinter' => 'ArcanistLinter',
|
||||||
'ArcanistLandWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistLandWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow',
|
'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow',
|
||||||
'ArcanistLicenseLinter' => 'ArcanistLinter',
|
|
||||||
'ArcanistLintConsoleRenderer' => 'ArcanistLintRenderer',
|
'ArcanistLintConsoleRenderer' => 'ArcanistLintRenderer',
|
||||||
'ArcanistLintJSONRenderer' => 'ArcanistLintRenderer',
|
'ArcanistLintJSONRenderer' => 'ArcanistLintRenderer',
|
||||||
'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
|
'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
final class ArcanistApacheLicenseLinter extends ArcanistLicenseLinter {
|
|
||||||
public function getLinterName() {
|
|
||||||
return 'APACHELICENSE';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLicenseText($copyright_holder) {
|
|
||||||
$year = date('Y');
|
|
||||||
|
|
||||||
return <<<EOLICENSE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright {$year} {$copyright_holder}
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
EOLICENSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLicensePatterns() {
|
|
||||||
$maybe_php_or_script = '(#![^\n]+?[\n])?(<[?]php\s+?)?';
|
|
||||||
return array(
|
|
||||||
"@^{$maybe_php_or_script}//[^\n]*Copyright[^\n]*[\n]\s*@i",
|
|
||||||
|
|
||||||
// We need to be careful about matching after "/*", since otherwise we'll
|
|
||||||
// end up in trouble on code like this, and consume the entire thing:
|
|
||||||
//
|
|
||||||
// /* a */
|
|
||||||
// copyright();
|
|
||||||
// /* b */
|
|
||||||
"@^{$maybe_php_or_script}/[*](?:[^*]|[*][^/])*?Copyright.*?[*]/\s*@is",
|
|
||||||
"@^{$maybe_php_or_script}\s*@",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
abstract class ArcanistLicenseLinter extends ArcanistLinter {
|
|
||||||
|
|
||||||
const LINT_NO_LICENSE_HEADER = 1;
|
|
||||||
|
|
||||||
public function willLintPaths(array $paths) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLintSeverityMap() {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLintNameMap() {
|
|
||||||
return array(
|
|
||||||
self::LINT_NO_LICENSE_HEADER => '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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue