]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Delete license linters.
authorBryan Cuccioli <blc72@cornell.edu>
Mon, 11 Feb 2013 17:04:19 +0000 (09:04 -0800)
committerepriestley <git@epriestley.com>
Mon, 11 Feb 2013 17:04:19 +0000 (09:04 -0800)
Summary: Remove all references to ArcanistLicenseLinter and ArcanistApacheLicenseLinter.

Test Plan: Rerun the linter and ensure nothing is broken.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4901

12 files changed:
src/__phutil_library_map__.php
src/lint/engine/ComprehensiveLintEngine.php
src/lint/linter/ArcanistApacheLicenseLinter.php [deleted file]
src/lint/linter/ArcanistLicenseLinter.php [deleted file]
src/lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php [deleted file]
src/lint/linter/__tests__/apachelicense/c-basic.lint-test [deleted file]
src/lint/linter/__tests__/apachelicense/greedy.lint-test [deleted file]
src/lint/linter/__tests__/apachelicense/php-basic.lint-test [deleted file]
src/lint/linter/__tests__/apachelicense/php-script.lint-test [deleted file]
src/lint/linter/__tests__/apachelicense/php-update-mess.lint-test [deleted file]
src/lint/linter/__tests__/apachelicense/php-update-multi.lint-test [deleted file]
src/lint/linter/__tests__/apachelicense/php-update-single.lint-test [deleted file]

index b41fe26475a434ef8a0918eafb4685b754b2f5bc..e0c89d1fb535dd8ea96e7d304b70580f7241c334 100644 (file)
@@ -13,8 +13,6 @@ phutil_register_library_map(array(
     'ArcanistAliasWorkflow' => 'workflow/ArcanistAliasWorkflow.php',
     'ArcanistAmendWorkflow' => 'workflow/ArcanistAmendWorkflow.php',
     'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
-    'ArcanistApacheLicenseLinter' => 'lint/linter/ArcanistApacheLicenseLinter.php',
-    'ArcanistApacheLicenseLinterTestCase' => 'lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php',
     'ArcanistArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistArcanistLinterTestCase.php',
     'ArcanistBaseCommitParser' => 'parser/ArcanistBaseCommitParser.php',
     'ArcanistBaseCommitParserTestCase' => 'parser/__tests__/ArcanistBaseCommitParserTestCase.php',
@@ -75,7 +73,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',
@@ -171,8 +168,6 @@ phutil_register_library_map(array(
     'ArcanistAliasWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistAnoidWorkflow' => 'ArcanistBaseWorkflow',
-    'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
-    'ArcanistApacheLicenseLinterTestCase' => 'ArcanistArcanistLinterTestCase',
     'ArcanistArcanistLinterTestCase' => 'ArcanistLinterTestCase',
     'ArcanistBaseCommitParserTestCase' => 'ArcanistTestCase',
     'ArcanistBaseWorkflow' => 'Phobject',
@@ -216,7 +211,6 @@ phutil_register_library_map(array(
     'ArcanistJSHintLinter' => 'ArcanistLinter',
     'ArcanistLandWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow',
-    'ArcanistLicenseLinter' => 'ArcanistLinter',
     'ArcanistLintConsoleRenderer' => 'ArcanistLintRenderer',
     'ArcanistLintJSONRenderer' => 'ArcanistLintRenderer',
     'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer',
index 9adae4ec8c755c0bd99a2e55f210087122173117..b0f2c20fd09a2b60f7ebdd22f10c1a8c9660dba4 100644 (file)
@@ -33,9 +33,6 @@ final class ComprehensiveLintEngine extends ArcanistLintEngine {
     $linters[] = id(new ArcanistXHPASTLinter())
       ->setPaths(preg_grep('/\.php$/', $paths));
 
-    $linters[] = id(new ArcanistApacheLicenseLinter())
-      ->setPaths(preg_grep('/\.(php|cpp|hpp|l|y)$/', $paths));
-
     $py_paths = preg_grep('/\.py$/', $paths);
     $linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths);
     $linters[] = id(new ArcanistPEP8Linter())
diff --git a/src/lint/linter/ArcanistApacheLicenseLinter.php b/src/lint/linter/ArcanistApacheLicenseLinter.php
deleted file mode 100644 (file)
index f87ffe0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/**
- * Adds the Apache license to source files.
- *
- * @group linter
- */
-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*@",
-    );
-  }
-}
diff --git a/src/lint/linter/ArcanistLicenseLinter.php b/src/lint/linter/ArcanistLicenseLinter.php
deleted file mode 100644 (file)
index 03401f6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/**
- * Adds a license or copyright header to source files.
- *
- * @group linter
- */
-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',
-    );
-  }
-
-  /**
-   * Given the name of the copyright holder, return appropriate license header
-   * text.
-   */
-  abstract protected function getLicenseText($copyright_holder);
-  /**
-   * Return an array of regular expressions that, if matched, indicate
-   * that a copyright header is required. The appropriate match will be
-   * stripped from the input when comparing against the expected license.
-   */
-  abstract protected function getLicensePatterns();
-
-  public function lintPath($path) {
-    $copyright_holder = $this->getConfig('copyright_holder');
-    if ($copyright_holder === null) {
-      $working_copy = $this->getEngine()->getWorkingCopy();
-      $copyright_holder = $working_copy->getConfig('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;
-      }
-    }
-  }
-}
-
-
diff --git a/src/lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php b/src/lint/linter/__tests__/ArcanistApacheLicenseLinterTestCase.php
deleted file mode 100644 (file)
index b8d6bb7..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * Test cases for @{class:ArcanistApacheLicenseLinter}.
- *
- * @group testcase
- */
-final class ArcanistApacheLicenseLinterTestCase
-  extends ArcanistArcanistLinterTestCase {
-
-  public function testApacheLicenseLint() {
-    $linter = new ArcanistApacheLicenseLinter();
-    $working_copy = ArcanistWorkingCopyIdentity::newFromPath(__FILE__);
-    return $this->executeTestsInDirectory(
-      dirname(__FILE__).'/apachelicense/',
-      $linter,
-      $working_copy);
-  }
-
-  protected function compareTransform($expected, $actual) {
-    $expected = str_replace('YYYY', date('Y'), $expected);
-    return parent::compareTransform($expected, $actual);
-  }
-
-}
diff --git a/src/lint/linter/__tests__/apachelicense/c-basic.lint-test b/src/lint/linter/__tests__/apachelicense/c-basic.lint-test
deleted file mode 100644 (file)
index 109eeb6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdio>
-
-int main(int argv, char **argv) {
-  return 0;
-}
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-#include <stdio>
-
-int main(int argv, char **argv) {
-  return 0;
-}
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}
diff --git a/src/lint/linter/__tests__/apachelicense/greedy.lint-test b/src/lint/linter/__tests__/apachelicense/greedy.lint-test
deleted file mode 100644 (file)
index 33a8a6a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/* Some Comment */
-
-function Copyright(Copyright $copyright) {
-  return new Copyright($copyright);
-}
-
-/* More Comments */
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-<?php
-
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-/* Some Comment */
-
-function Copyright(Copyright $copyright) {
-  return new Copyright($copyright);
-}
-
-/* More Comments */
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}
diff --git a/src/lint/linter/__tests__/apachelicense/php-basic.lint-test b/src/lint/linter/__tests__/apachelicense/php-basic.lint-test
deleted file mode 100644 (file)
index 72d75e3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-do_stuff();
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-<?php
-
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-do_stuff();
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}
diff --git a/src/lint/linter/__tests__/apachelicense/php-script.lint-test b/src/lint/linter/__tests__/apachelicense/php-script.lint-test
deleted file mode 100644 (file)
index 9cce53e..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/php
-<?php
-
-do_stuff();
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-#!/usr/bin/php
-<?php
-
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-do_stuff();
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}
diff --git a/src/lint/linter/__tests__/apachelicense/php-update-mess.lint-test b/src/lint/linter/__tests__/apachelicense/php-update-mess.lint-test
deleted file mode 100644 (file)
index 286f0dc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/*****COPYRIGHT
-  COPYRIGHT // ************** // COPYRIGHT
-**/
-
-do_stuff();
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-<?php
-
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-do_stuff();
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}
diff --git a/src/lint/linter/__tests__/apachelicense/php-update-multi.lint-test b/src/lint/linter/__tests__/apachelicense/php-update-multi.lint-test
deleted file mode 100644 (file)
index 6a54847..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/* Copyright 1901 Facebook */
-
-do_stuff();
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-<?php
-
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-do_stuff();
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}
diff --git a/src/lint/linter/__tests__/apachelicense/php-update-single.lint-test b/src/lint/linter/__tests__/apachelicense/php-update-single.lint-test
deleted file mode 100644 (file)
index 6a54847..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/* Copyright 1901 Facebook */
-
-do_stuff();
-~~~~~~~~~~
-error:1:1
-~~~~~~~~~~
-<?php
-
-/*
- * Copyright YYYY Facebook, Inc.
- *
- * 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.
- */
-
-do_stuff();
-~~~~~~~~~~
-{"config": {"copyright_holder": "Facebook, Inc."}}