mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 00:42:40 +01:00
Remove the ExampleLintEngine
class.
Summary: Ref T2039. Now that the `ArcanistConfigurationDrivenLintEngine` has gained more widespread use, we do no longer expect users to need to write their own lint engine. The documentation has already been updated to reflect this. Test Plan: N/A Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T2039 Differential Revision: https://secure.phabricator.com/D9198
This commit is contained in:
parent
615fc0a7f8
commit
1b3eb9a247
2 changed files with 0 additions and 68 deletions
|
@ -185,7 +185,6 @@ phutil_register_library_map(array(
|
|||
'ArcanistXUnitTestResultParser' => 'unit/engine/ArcanistXUnitTestResultParser.php',
|
||||
'CSharpToolsTestEngine' => 'unit/engine/CSharpToolsTestEngine.php',
|
||||
'ComprehensiveLintEngine' => 'lint/engine/ComprehensiveLintEngine.php',
|
||||
'ExampleLintEngine' => 'lint/engine/ExampleLintEngine.php',
|
||||
'GoTestResultParser' => 'unit/engine/GoTestResultParser.php',
|
||||
'GoTestResultParserTestCase' => 'unit/engine/__tests__/GoTestResultParserTestCase.php',
|
||||
'NoseTestEngine' => 'unit/engine/NoseTestEngine.php',
|
||||
|
@ -343,7 +342,6 @@ phutil_register_library_map(array(
|
|||
'ArcanistXMLLinterTestCase' => 'ArcanistArcanistLinterTestCase',
|
||||
'CSharpToolsTestEngine' => 'XUnitTestEngine',
|
||||
'ComprehensiveLintEngine' => 'ArcanistLintEngine',
|
||||
'ExampleLintEngine' => 'ArcanistLintEngine',
|
||||
'GoTestResultParser' => 'ArcanistBaseTestResultParser',
|
||||
'GoTestResultParserTestCase' => 'ArcanistTestCase',
|
||||
'NoseTestEngine' => 'ArcanistBaseUnitTestEngine',
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This a simple example lint engine which just applies the
|
||||
* @{class:ArcanistPyLintLinter} to any Python files. For a more complex
|
||||
* example, see @{class:PhutilLintEngine}.
|
||||
*
|
||||
* @group linter
|
||||
*/
|
||||
final class ExampleLintEngine extends ArcanistLintEngine {
|
||||
|
||||
public function buildLinters() {
|
||||
|
||||
// This is a list of paths which the user wants to lint. Either they
|
||||
// provided them explicitly, or arc figured them out from a commit or set
|
||||
// of changes. The engine needs to return a list of ArcanistLinter objects,
|
||||
// representing the linters which should be run on these files.
|
||||
$paths = $this->getPaths();
|
||||
|
||||
// The ArcanistPyLintLinter runs "PyLint" (an open source python linter) on
|
||||
// files you give it. There are several linters available by default like
|
||||
// this one which you can use out of the box, or you can write your own.
|
||||
// Linters are responsible for actually analyzing the contents of a file
|
||||
// and raising warnings and errors.
|
||||
$pylint_linter = new ArcanistPyLintLinter();
|
||||
|
||||
// Remove any paths that don't exist before we add paths to linters. We want
|
||||
// to do this for linters that operate on file contents because the
|
||||
// generated list of paths will include deleted paths when a file is
|
||||
// removed.
|
||||
foreach ($paths as $key => $path) {
|
||||
if (!$this->pathExists($path)) {
|
||||
unset($paths[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (!preg_match('/\.py$/', $path)) {
|
||||
// This isn't a python file, so don't try to apply the PyLint linter
|
||||
// to it.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('@^externals/@', $path)) {
|
||||
// This is just an example of how to exclude a path so it doesn't get
|
||||
// linted. If you put third-party code in an externals/ directory, you
|
||||
// can just have your lint engine ignore it.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the path, to tell the linter it should examine the source code
|
||||
// to try to find problems.
|
||||
$pylint_linter->addPath($path);
|
||||
}
|
||||
|
||||
// We only built one linter, but you can build more than one (e.g., a
|
||||
// Javascript linter for JS), and return a list of linters to execute. You
|
||||
// can also add a path to more than one linter (for example, if you want
|
||||
// to run a Python linter and a more general text linter on every .py file).
|
||||
|
||||
return array(
|
||||
$pylint_linter,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue