Page MenuHomeSealhub

No OneTemporary

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index f9fe6907..dd5b4f0c 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1,121 +1,123 @@
<?php
/**
* This file is automatically generated. Use 'phutil_mapper.php' to rebuild it.
* @generated
*/
phutil_register_library_map(array(
'class' =>
array(
'ArcanistAmendWorkflow' => 'workflow/amend',
'ArcanistApacheLicenseLinter' => 'lint/linter/apachelicense',
'ArcanistApacheLicenseLinterTestCase' => 'lint/linter/apachelicense/__tests__',
'ArcanistBaseUnitTestEngine' => 'unit/engine/base',
'ArcanistBaseWorkflow' => 'workflow/base',
'ArcanistBundle' => 'parser/bundle',
'ArcanistChooseInvalidRevisionException' => 'exception',
'ArcanistChooseNoRevisionsException' => 'exception',
'ArcanistCommitWorkflow' => 'workflow/commit',
'ArcanistConfiguration' => 'configuration',
'ArcanistCoverWorkflow' => 'workflow/cover',
'ArcanistDiffChange' => 'parser/diff/change',
'ArcanistDiffChangeType' => 'parser/diff/changetype',
'ArcanistDiffHunk' => 'parser/diff/hunk',
'ArcanistDiffParser' => 'parser/diff',
'ArcanistDiffParserTestCase' => 'parser/diff/__tests__',
'ArcanistDiffUtils' => 'difference',
'ArcanistDiffWorkflow' => 'workflow/diff',
'ArcanistDifferentialCommitMessage' => 'differential/commitmessage',
'ArcanistDifferentialCommitMessageParserException' => 'differential/commitmessage',
'ArcanistDifferentialRevisionRef' => 'differential/revision',
'ArcanistExportWorkflow' => 'workflow/export',
'ArcanistFilenameLinter' => 'lint/linter/filename',
'ArcanistGeneratedLinter' => 'lint/linter/generated',
'ArcanistGitAPI' => 'repository/api/git',
'ArcanistGitHookPreReceiveWorkflow' => 'workflow/git-hook-pre-receive',
'ArcanistHelpWorkflow' => 'workflow/help',
'ArcanistLicenseLinter' => 'lint/linter/license',
'ArcanistLintEngine' => 'lint/engine/base',
'ArcanistLintMessage' => 'lint/message',
'ArcanistLintPatcher' => 'lint/patcher',
'ArcanistLintRenderer' => 'lint/renderer',
'ArcanistLintResult' => 'lint/result',
'ArcanistLintSeverity' => 'lint/severity',
'ArcanistLintWorkflow' => 'workflow/lint',
'ArcanistLinter' => 'lint/linter/base',
'ArcanistLinterTestCase' => 'lint/linter/base/test',
'ArcanistListWorkflow' => 'workflow/list',
'ArcanistMarkCommittedWorkflow' => 'workflow/mark-committed',
'ArcanistNoEffectException' => 'exception/usage/noeffect',
'ArcanistNoEngineException' => 'exception/usage/noengine',
+ 'ArcanistNoLintLinter' => 'lint/linter/nolint',
'ArcanistPEP8Linter' => 'lint/linter/pep8',
'ArcanistPatchWorkflow' => 'workflow/patch',
'ArcanistPhutilModuleLinter' => 'lint/linter/phutilmodule',
'ArcanistPhutilTestCase' => 'unit/engine/phutil/testcase',
'ArcanistPhutilTestTerminatedException' => 'unit/engine/phutil/testcase/exception',
'ArcanistRepositoryAPI' => 'repository/api/base',
'ArcanistShellCompleteWorkflow' => 'workflow/shell-complete',
'ArcanistSubversionAPI' => 'repository/api/subversion',
'ArcanistSvnHookPreCommitWorkflow' => 'workflow/svn-hook-pre-commit',
'ArcanistTextLinter' => 'lint/linter/text',
'ArcanistTextLinterTestCase' => 'lint/linter/text/__tests__',
'ArcanistUnitTestResult' => 'unit/result',
'ArcanistUnitWorkflow' => 'workflow/unit',
'ArcanistUsageException' => 'exception/usage',
'ArcanistUserAbortException' => 'exception/usage/userabort',
'ArcanistWorkingCopyIdentity' => 'workingcopyidentity',
'ArcanistXHPASTLinter' => 'lint/linter/xhpast',
'ArcanistXHPASTLinterTestCase' => 'lint/linter/xhpast/__tests__',
'PhutilLintEngine' => 'lint/engine/phutil',
'PhutilModuleRequirements' => 'parser/phutilmodule',
'PhutilUnitTestEngine' => 'unit/engine/phutil',
'PhutilUnitTestEngineTestCase' => 'unit/engine/phutil/__tests__',
'UnitTestableArcanistLintEngine' => 'lint/engine/test',
),
'function' =>
array(
),
'requires_class' =>
array(
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
'ArcanistApacheLicenseLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistCommitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistCoverWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistDiffParserTestCase' => 'ArcanistPhutilTestCase',
'ArcanistDiffWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistExportWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistFilenameLinter' => 'ArcanistLinter',
'ArcanistGeneratedLinter' => 'ArcanistLinter',
'ArcanistGitAPI' => 'ArcanistRepositoryAPI',
'ArcanistGitHookPreReceiveWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistHelpWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLicenseLinter' => 'ArcanistLinter',
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
+ 'ArcanistNoLintLinter' => 'ArcanistLinter',
'ArcanistPEP8Linter' => 'ArcanistLinter',
'ArcanistPatchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
'ArcanistShellCompleteWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistTextLinter' => 'ArcanistLinter',
'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistUnitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUserAbortException' => 'ArcanistUsageException',
'ArcanistXHPASTLinter' => 'ArcanistLinter',
'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
'PhutilLintEngine' => 'ArcanistLintEngine',
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
'PhutilUnitTestEngineTestCase' => 'ArcanistPhutilTestCase',
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
),
'requires_interface' =>
array(
),
));
diff --git a/src/lint/engine/phutil/PhutilLintEngine.php b/src/lint/engine/phutil/PhutilLintEngine.php
index d923c166..cc1d25a4 100644
--- a/src/lint/engine/phutil/PhutilLintEngine.php
+++ b/src/lint/engine/phutil/PhutilLintEngine.php
@@ -1,101 +1,107 @@
<?php
/*
* Copyright 2011 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.
*/
/**
* Lint engine which enforces libphutil rules.
*
* @group linter
*/
class PhutilLintEngine extends ArcanistLintEngine {
public function buildLinters() {
$linters = array();
$paths = $this->getPaths();
// This needs to go first so that changes to generated files cause module
// linting. This linter also operates on removed files, because removing
// a file changes the static properties of a module.
$module_linter = new ArcanistPhutilModuleLinter();
$linters[] = $module_linter;
foreach ($paths as $path) {
$module_linter->addPath($path);
}
// Remaining lint engines operate on file contents and ignore removed
// files.
foreach ($paths as $key => $path) {
if (!$this->pathExists($path)) {
unset($paths[$key]);
}
if (preg_match('@^externals/@', $path)) {
// Third-party stuff lives in /externals/; don't run lint engines
// against it.
unset($paths[$key]);
}
}
$generated_linter = new ArcanistGeneratedLinter();
$linters[] = $generated_linter;
+ $nolint_linter = new ArcanistNoLintLinter();
+ $linters[] = $nolint_linter;
+
$text_linter = new ArcanistTextLinter();
$linters[] = $text_linter;
foreach ($paths as $path) {
$is_text = false;
if (preg_match('/\.(php|css|js)$/', $path)) {
$is_text = true;
}
if ($is_text) {
$generated_linter->addPath($path);
$generated_linter->addData($path, $this->loadData($path));
+ $nolint_linter->addPath($path);
+ $nolint_linter->addData($path, $this->loadData($path));
+
$text_linter->addPath($path);
$text_linter->addData($path, $this->loadData($path));
}
}
$name_linter = new ArcanistFilenameLinter();
$linters[] = $name_linter;
foreach ($paths as $path) {
$name_linter->addPath($path);
}
$xhpast_linter = new ArcanistXHPASTLinter();
$license_linter = new ArcanistApacheLicenseLinter();
$linters[] = $xhpast_linter;
$linters[] = $license_linter;
foreach ($paths as $path) {
if (preg_match('/\.php$/', $path)) {
$xhpast_linter->addPath($path);
$xhpast_linter->addData($path, $this->loadData($path));
}
}
foreach ($paths as $path) {
if (preg_match('/\.(php|cpp|hpp|l|y)$/', $path)) {
if (!preg_match('@^externals/@', $path)) {
$license_linter->addPath($path);
$license_linter->addData($path, $this->loadData($path));
}
}
}
return $linters;
}
}
diff --git a/src/lint/engine/phutil/__init__.php b/src/lint/engine/phutil/__init__.php
index 77ce9ef9..1f5377b7 100644
--- a/src/lint/engine/phutil/__init__.php
+++ b/src/lint/engine/phutil/__init__.php
@@ -1,18 +1,19 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('arcanist', 'lint/engine/base');
phutil_require_module('arcanist', 'lint/linter/apachelicense');
phutil_require_module('arcanist', 'lint/linter/filename');
phutil_require_module('arcanist', 'lint/linter/generated');
+phutil_require_module('arcanist', 'lint/linter/nolint');
phutil_require_module('arcanist', 'lint/linter/phutilmodule');
phutil_require_module('arcanist', 'lint/linter/text');
phutil_require_module('arcanist', 'lint/linter/xhpast');
phutil_require_source('PhutilLintEngine.php');
diff --git a/src/lint/linter/generated/ArcanistGeneratedLinter.php b/src/lint/linter/generated/ArcanistGeneratedLinter.php
index db739091..91e30eff 100644
--- a/src/lint/linter/generated/ArcanistGeneratedLinter.php
+++ b/src/lint/linter/generated/ArcanistGeneratedLinter.php
@@ -1,35 +1,51 @@
<?php
+/*
+ * Copyright 2011 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.
+ */
+
/**
* Stops other linters from running on generated code.
*
* @group linter
*/
class ArcanistGeneratedLinter extends ArcanistLinter {
public function willLintPaths(array $paths) {
return;
}
public function getLinterName() {
return 'GEN';
}
public function getLintSeverityMap() {
return array();
}
public function getLintNameMap() {
return array(
);
}
public function lintPath($path) {
$data = $this->getData($path);
-
- if (preg_match('/@generated/', $data)) {
+
+ if (preg_match('/@'.'generated/', $data)) {
$this->stopAllLinters();
}
}
}
diff --git a/src/lint/linter/nolint/ArcanistNoLintLinter.php b/src/lint/linter/nolint/ArcanistNoLintLinter.php
new file mode 100644
index 00000000..705446ee
--- /dev/null
+++ b/src/lint/linter/nolint/ArcanistNoLintLinter.php
@@ -0,0 +1,50 @@
+<?php
+
+/*
+ * Copyright 2011 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.
+ */
+
+/**
+ * Stops other linters from running on code marked with
+ * a nolint annotation.
+ *
+ * @group linter
+ */
+class ArcanistNoLintLinter extends ArcanistLinter {
+ public function willLintPaths(array $paths) {
+ return;
+ }
+
+ public function getLinterName() {
+ return 'NOLINT';
+ }
+
+ public function getLintSeverityMap() {
+ return array();
+ }
+
+ public function getLintNameMap() {
+ return array(
+ );
+ }
+
+ public function lintPath($path) {
+ $data = $this->getData($path);
+
+ if (preg_match('/@'.'nolint/', $data)) {
+ $this->stopAllLinters();
+ }
+ }
+}
diff --git a/src/lint/linter/nolint/__init__.php b/src/lint/linter/nolint/__init__.php
new file mode 100644
index 00000000..65ac5d66
--- /dev/null
+++ b/src/lint/linter/nolint/__init__.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * This file is automatically generated. Lint this module to rebuild it.
+ * @generated
+ */
+
+
+
+phutil_require_module('arcanist', 'lint/linter/base');
+
+
+phutil_require_source('ArcanistNoLintLinter.php');
diff --git a/src/lint/linter/nolint/__tests__/ArcanistNoLintTestCase.php b/src/lint/linter/nolint/__tests__/ArcanistNoLintTestCase.php
new file mode 100644
index 00000000..8be51dbd
--- /dev/null
+++ b/src/lint/linter/nolint/__tests__/ArcanistNoLintTestCase.php
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * Copyright 2011 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.
+ */
+
+/**
+ * Test for @{class:ArcanistNoLintLinter}.
+ *
+ * Not a real test... meant to fail lint
+ * if @nolint is not respected.
+ *
+ * @group testcase
+ */
+class ArcanistNoLintTestCaseMisnamed extends ArcanistLinterTestCase {
+
+}
diff --git a/src/lint/linter/nolint/__tests__/__init__.php b/src/lint/linter/nolint/__tests__/__init__.php
new file mode 100644
index 00000000..5c3f320e
--- /dev/null
+++ b/src/lint/linter/nolint/__tests__/__init__.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * This file is automatically generated. Lint this module to rebuild it.
+ * @generated
+ */
+
+
+
+phutil_require_module('arcanist', 'lint/linter/base/test');
+
+
+phutil_require_source('ArcanistNoLintTestCase.php');

File Metadata

Mime Type
text/x-diff
Expires
Sat, Oct 11, 06:30 (6 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
983875
Default Alt Text
(15 KB)

Event Timeline