Page MenuHomePhorge

No OneTemporary

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 26f1d2e7..9e24b9c5 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1,177 +1,179 @@
<?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',
'ArcanistBranchWorkflow' => 'workflow/branch',
'ArcanistBundle' => 'parser/bundle',
'ArcanistBundleTestCase' => 'parser/bundle/__tests__',
'ArcanistCallConduitWorkflow' => 'workflow/call-conduit',
'ArcanistCapabilityNotSupportedException' => 'workflow/exception/notsupported',
'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',
'ArcanistDiffUtilsTestCase' => 'difference/__tests__',
'ArcanistDiffWorkflow' => 'workflow/diff',
'ArcanistDifferentialCommitMessage' => 'differential/commitmessage',
'ArcanistDifferentialCommitMessageParserException' => 'differential/commitmessage',
'ArcanistDifferentialRevisionHash' => 'differential/constants/revisionhash',
'ArcanistDifferentialRevisionRef' => 'differential/revision',
'ArcanistDifferentialRevisionStatus' => 'differential/constants/revisionstatus',
'ArcanistDownloadWorkflow' => 'workflow/download',
'ArcanistEventType' => 'events/constant/type',
'ArcanistExportWorkflow' => 'workflow/export',
'ArcanistFilenameLinter' => 'lint/linter/filename',
'ArcanistGeneratedLinter' => 'lint/linter/generated',
'ArcanistGitAPI' => 'repository/api/git',
'ArcanistGitHookPreReceiveWorkflow' => 'workflow/git-hook-pre-receive',
'ArcanistHelpWorkflow' => 'workflow/help',
'ArcanistHookAPI' => 'repository/hookapi/base',
'ArcanistInstallCertificateWorkflow' => 'workflow/install-certificate',
'ArcanistJSHintLinter' => 'lint/linter/jshint',
'ArcanistLiberateLintEngine' => 'lint/engine/liberate',
'ArcanistLiberateWorkflow' => 'workflow/liberate',
'ArcanistLicenseLinter' => 'lint/linter/license',
'ArcanistLintEngine' => 'lint/engine/base',
'ArcanistLintJSONRenderer' => 'lint/renderer',
'ArcanistLintMessage' => 'lint/message',
'ArcanistLintPatcher' => 'lint/patcher',
'ArcanistLintRenderer' => 'lint/renderer',
'ArcanistLintResult' => 'lint/result',
'ArcanistLintSeverity' => 'lint/severity',
'ArcanistLintSummaryRenderer' => 'lint/renderer',
'ArcanistLintWorkflow' => 'workflow/lint',
'ArcanistLinter' => 'lint/linter/base',
'ArcanistLinterTestCase' => 'lint/linter/base/test',
'ArcanistListWorkflow' => 'workflow/list',
'ArcanistMarkCommittedWorkflow' => 'workflow/mark-committed',
'ArcanistMercurialAPI' => 'repository/api/mercurial',
'ArcanistMercurialParser' => 'repository/parser/mercurial',
'ArcanistMercurialParserTestCase' => 'repository/parser/mercurial/__tests__',
'ArcanistMergeWorkflow' => 'workflow/merge',
'ArcanistNoEffectException' => 'exception/usage/noeffect',
'ArcanistNoEngineException' => 'exception/usage/noengine',
'ArcanistNoLintLinter' => 'lint/linter/nolint',
'ArcanistNoLintTestCaseMisnamed' => 'lint/linter/nolint/__tests__',
'ArcanistPEP8Linter' => 'lint/linter/pep8',
'ArcanistPasteWorkflow' => 'workflow/paste',
'ArcanistPatchWorkflow' => 'workflow/patch',
'ArcanistPhutilModuleLinter' => 'lint/linter/phutilmodule',
'ArcanistPhutilTestCase' => 'unit/engine/phutil/testcase',
'ArcanistPhutilTestTerminatedException' => 'unit/engine/phutil/testcase/exception',
'ArcanistPyFlakesLinter' => 'lint/linter/pyflakes',
'ArcanistPyLintLinter' => 'lint/linter/pylint',
'ArcanistRepositoryAPI' => 'repository/api/base',
'ArcanistShellCompleteWorkflow' => 'workflow/shell-complete',
'ArcanistSpellingDefaultData' => 'lint/linter/spelling',
'ArcanistSpellingLinter' => 'lint/linter/spelling',
'ArcanistSpellingLinterTestCase' => 'lint/linter/spelling/__tests__',
'ArcanistSubversionAPI' => 'repository/api/subversion',
'ArcanistSubversionHookAPI' => 'repository/hookapi/subversion',
'ArcanistSvnHookPreCommitWorkflow' => 'workflow/svn-hook-pre-commit',
'ArcanistTextLinter' => 'lint/linter/text',
'ArcanistTextLinterTestCase' => 'lint/linter/text/__tests__',
'ArcanistUnitTestResult' => 'unit/result',
'ArcanistUnitWorkflow' => 'workflow/unit',
'ArcanistUploadWorkflow' => 'workflow/upload',
'ArcanistUsageException' => 'exception/usage',
'ArcanistUserAbortException' => 'exception/usage/userabort',
'ArcanistWorkingCopyIdentity' => 'workingcopyidentity',
'ArcanistXHPASTLintNamingHook' => 'lint/linter/xhpast/naminghook',
'ArcanistXHPASTLinter' => 'lint/linter/xhpast',
'ArcanistXHPASTLinterTestCase' => 'lint/linter/xhpast/__tests__',
'BranchInfo' => 'branch',
+ 'ComprehensiveEngine' => 'lint/engine/comprehensive',
'ExampleLintEngine' => 'lint/engine/example',
'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',
'ArcanistBranchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistBundleTestCase' => 'ArcanistPhutilTestCase',
'ArcanistCallConduitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistCommitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistCoverWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistDiffParserTestCase' => 'ArcanistPhutilTestCase',
'ArcanistDiffUtilsTestCase' => 'ArcanistPhutilTestCase',
'ArcanistDiffWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistDownloadWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistEventType' => 'PhutilEventType',
'ArcanistExportWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistFilenameLinter' => 'ArcanistLinter',
'ArcanistGeneratedLinter' => 'ArcanistLinter',
'ArcanistGitAPI' => 'ArcanistRepositoryAPI',
'ArcanistGitHookPreReceiveWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistHelpWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistInstallCertificateWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistJSHintLinter' => 'ArcanistLinter',
'ArcanistLiberateLintEngine' => 'ArcanistLintEngine',
'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLicenseLinter' => 'ArcanistLinter',
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
'ArcanistMercurialParserTestCase' => 'ArcanistPhutilTestCase',
'ArcanistMergeWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter',
'ArcanistNoLintTestCaseMisnamed' => 'ArcanistLinterTestCase',
'ArcanistPEP8Linter' => 'ArcanistLinter',
'ArcanistPasteWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistPatchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
'ArcanistPyLintLinter' => 'ArcanistLinter',
'ArcanistShellCompleteWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistSpellingLinter' => 'ArcanistLinter',
'ArcanistSpellingLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistTextLinter' => 'ArcanistLinter',
'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistUnitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUploadWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUserAbortException' => 'ArcanistUsageException',
'ArcanistXHPASTLinter' => 'ArcanistLinter',
'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
+ 'ComprehensiveEngine' => 'ArcanistLintEngine',
'ExampleLintEngine' => 'ArcanistLintEngine',
'PhutilLintEngine' => 'ArcanistLintEngine',
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
'PhutilUnitTestEngineTestCase' => 'ArcanistPhutilTestCase',
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
),
'requires_interface' =>
array(
),
));
diff --git a/src/lint/engine/comprehensive/ComprehensiveLintEngine.php b/src/lint/engine/comprehensive/ComprehensiveLintEngine.php
new file mode 100644
index 00000000..2aea781a
--- /dev/null
+++ b/src/lint/engine/comprehensive/ComprehensiveLintEngine.php
@@ -0,0 +1,148 @@
+<?php
+
+/*
+ * Copyright 2012 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.
+ */
+
+/**
+ * Basic lint engine which just applies several linters based on the file types
+ *
+ * @group linter
+ */
+class ComprehensiveLintEngine 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|hpp|cpp|l|y)$/', $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();
+ $linters[] = $xhpast_linter;
+ foreach ($paths as $path) {
+ if (preg_match('/\.php$/', $path)) {
+ $xhpast_linter->addPath($path);
+ $xhpast_linter->addData($path, $this->loadData($path));
+ }
+ }
+
+ $linters = array_merge($linters, $this->buildLicenseLinters($paths));
+ $linters = array_merge($linters, $this->buildPythonLinters($paths));
+ $linters = array_merge($linters, $this->buildJSLinters($paths));
+
+ return $linters;
+ }
+
+ public function buildLicenseLinters($paths) {
+ $license_linter = new ArcanistApacheLicenseLinter();
+
+ $linters = array();
+ $linters[] = $license_linter;
+ 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;
+ }
+
+ public function buildPythonLinters($paths) {
+ $pyflakes_linter = new ArcanistPyFlakesLinter();
+ $pep8_linter = new ArcanistPEP8Linter();
+
+ $linters = array();
+ $linters[] = $pyflakes_linter;
+ $linters[] = $pep8_linter;
+ foreach ($paths as $path) {
+ if (preg_match('/\.py$/', $path)) {
+ $pyflakes_linter->addPath($path);
+ $pyflakes_linter->addData($path, $this->loadData($path));
+ $pep8_linter->addPath($path);
+ $pep8_linter->addData($path, $this->loadData($path));
+ }
+ }
+ return $linters;
+ }
+
+ public function buildJSLinters($paths) {
+ $js_linter = new ArcanistJSHintLinter();
+
+ $linters = array();
+ $linters[] = $js_linter;
+ foreach ($paths as $path) {
+ if (preg_match('/\.js$/', $path)) {
+ $js_linter->addPath($path);
+ $js_linter->addData($path, $this->loadData($path));
+ }
+ }
+ return $linters;
+ }
+
+}
diff --git a/src/lint/engine/comprehensive/__init__.php b/src/lint/engine/comprehensive/__init__.php
new file mode 100644
index 00000000..0bd8062b
--- /dev/null
+++ b/src/lint/engine/comprehensive/__init__.php
@@ -0,0 +1,22 @@
+<?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/jshint');
+phutil_require_module('arcanist', 'lint/linter/nolint');
+phutil_require_module('arcanist', 'lint/linter/pep8');
+phutil_require_module('arcanist', 'lint/linter/phutilmodule');
+phutil_require_module('arcanist', 'lint/linter/pyflakes');
+phutil_require_module('arcanist', 'lint/linter/text');
+phutil_require_module('arcanist', 'lint/linter/xhpast');
+
+
+phutil_require_source('ComprehensiveLintEngine.php');
diff --git a/src/lint/linter/jshint/__init__.php b/src/lint/linter/jshint/__init__.php
index 80349853..905986ae 100644
--- a/src/lint/linter/jshint/__init__.php
+++ b/src/lint/linter/jshint/__init__.php
@@ -1,16 +1,18 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
+phutil_require_module('arcanist', 'exception/usage');
phutil_require_module('arcanist', 'lint/linter/base');
-phutil_require_module('arcanist', 'lint/message');
phutil_require_module('arcanist', 'lint/severity');
+phutil_require_module('phutil', 'filesystem');
+phutil_require_module('phutil', 'future');
phutil_require_module('phutil', 'future/exec');
phutil_require_source('ArcanistJSHintLinter.php');

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 19:13 (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127852
Default Alt Text
(15 KB)

Event Timeline