diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index b278c3a5..1008913c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -59,15 +59,16 @@ phutil_register_library_map(array( 'ArcanistLiberateLintEngine' => 'lint/engine/ArcanistLiberateLintEngine.php', 'ArcanistLiberateWorkflow' => 'workflow/ArcanistLiberateWorkflow.php', 'ArcanistLicenseLinter' => 'lint/linter/ArcanistLicenseLinter.php', + 'ArcanistLintConsoleRenderer' => 'lint/renderer/ArcanistLintConsoleRenderer.php', 'ArcanistLintEngine' => 'lint/engine/ArcanistLintEngine.php', - 'ArcanistLintJSONRenderer' => 'lint/ArcanistLintJSONRenderer.php', - 'ArcanistLintLikeCompilerRenderer' => 'lint/ArcanistLintLikeCompilerRenderer.php', + 'ArcanistLintJSONRenderer' => 'lint/renderer/ArcanistLintJSONRenderer.php', + 'ArcanistLintLikeCompilerRenderer' => 'lint/renderer/ArcanistLintLikeCompilerRenderer.php', 'ArcanistLintMessage' => 'lint/ArcanistLintMessage.php', 'ArcanistLintPatcher' => 'lint/ArcanistLintPatcher.php', - 'ArcanistLintRenderer' => 'lint/ArcanistLintRenderer.php', + 'ArcanistLintRenderer' => 'lint/renderer/ArcanistLintRenderer.php', 'ArcanistLintResult' => 'lint/ArcanistLintResult.php', 'ArcanistLintSeverity' => 'lint/ArcanistLintSeverity.php', - 'ArcanistLintSummaryRenderer' => 'lint/ArcanistLintSummaryRenderer.php', + 'ArcanistLintSummaryRenderer' => 'lint/renderer/ArcanistLintSummaryRenderer.php', 'ArcanistLintWorkflow' => 'workflow/ArcanistLintWorkflow.php', 'ArcanistLinter' => 'lint/linter/ArcanistLinter.php', 'ArcanistLinterTestCase' => 'lint/linter/__tests__/ArcanistLinterTestCase.php', @@ -169,6 +170,10 @@ phutil_register_library_map(array( 'ArcanistLiberateLintEngine' => 'ArcanistLintEngine', 'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistLicenseLinter' => 'ArcanistLinter', + 'ArcanistLintConsoleRenderer' => 'ArcanistLintRenderer', + 'ArcanistLintJSONRenderer' => 'ArcanistLintRenderer', + 'ArcanistLintLikeCompilerRenderer' => 'ArcanistLintRenderer', + 'ArcanistLintSummaryRenderer' => 'ArcanistLintRenderer', 'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase', 'ArcanistListWorkflow' => 'ArcanistBaseWorkflow', diff --git a/src/lint/ArcanistLintRenderer.php b/src/lint/renderer/ArcanistLintConsoleRenderer.php similarity index 98% rename from src/lint/ArcanistLintRenderer.php rename to src/lint/renderer/ArcanistLintConsoleRenderer.php index 3f9cb480..944acfe7 100644 --- a/src/lint/ArcanistLintRenderer.php +++ b/src/lint/renderer/ArcanistLintConsoleRenderer.php @@ -21,7 +21,7 @@ * * @group lint */ -final class ArcanistLintRenderer { +final class ArcanistLintConsoleRenderer implements ArcanistLintRenderer { private $showAutofixPatches = false; public function setShowAutofixPatches($show_autofix_patches) { diff --git a/src/lint/ArcanistLintJSONRenderer.php b/src/lint/renderer/ArcanistLintJSONRenderer.php similarity index 95% rename from src/lint/ArcanistLintJSONRenderer.php rename to src/lint/renderer/ArcanistLintJSONRenderer.php index ddaa70c6..423845ec 100644 --- a/src/lint/ArcanistLintJSONRenderer.php +++ b/src/lint/renderer/ArcanistLintJSONRenderer.php @@ -21,7 +21,7 @@ * * @group lint */ -final class ArcanistLintJSONRenderer { +final class ArcanistLintJSONRenderer implements ArcanistLintRenderer { const LINES_OF_CONTEXT = 3; public function renderLintResult(ArcanistLintResult $result) { diff --git a/src/lint/ArcanistLintLikeCompilerRenderer.php b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php similarity index 94% rename from src/lint/ArcanistLintLikeCompilerRenderer.php rename to src/lint/renderer/ArcanistLintLikeCompilerRenderer.php index 53316aa9..bc75d5ba 100644 --- a/src/lint/ArcanistLintLikeCompilerRenderer.php +++ b/src/lint/renderer/ArcanistLintLikeCompilerRenderer.php @@ -21,7 +21,7 @@ * * @group lint */ -final class ArcanistLintLikeCompilerRenderer { +final class ArcanistLintLikeCompilerRenderer implements ArcanistLintRenderer { public function renderLintResult(ArcanistLintResult $result) { $lines = array(); $messages = $result->getMessages(); diff --git a/src/lint/renderer/ArcanistLintRenderer.php b/src/lint/renderer/ArcanistLintRenderer.php new file mode 100644 index 00000000..aacd4ec6 --- /dev/null +++ b/src/lint/renderer/ArcanistLintRenderer.php @@ -0,0 +1,27 @@ +getMessages(); $path = $result->getPath(); diff --git a/src/workflow/ArcanistLiberateWorkflow.php b/src/workflow/ArcanistLiberateWorkflow.php index a709aa53..fd189ea1 100644 --- a/src/workflow/ArcanistLiberateWorkflow.php +++ b/src/workflow/ArcanistLiberateWorkflow.php @@ -393,7 +393,7 @@ EOTEXT $paths = $this->liberateGetChangedPaths($path); $results = $this->liberateLintModules($path, $paths); - $renderer = new ArcanistLintRenderer(); + $renderer = new ArcanistLintConsoleRenderer(); $unresolved = false; foreach ($results as $result) { diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php index 43c35ddb..96ed2109 100644 --- a/src/workflow/ArcanistLintWorkflow.php +++ b/src/workflow/ArcanistLintWorkflow.php @@ -239,7 +239,7 @@ EOTEXT $apply_patches = $this->getArgument('apply-patches'); break; default: - $renderer = new ArcanistLintRenderer(); + $renderer = new ArcanistLintConsoleRenderer(); $renderer->setShowAutofixPatches($prompt_autofix_patches); break; } diff --git a/src/workflow/ArcanistSvnHookPreCommitWorkflow.php b/src/workflow/ArcanistSvnHookPreCommitWorkflow.php index d8e4fe49..a4379fc5 100644 --- a/src/workflow/ArcanistSvnHookPreCommitWorkflow.php +++ b/src/workflow/ArcanistSvnHookPreCommitWorkflow.php @@ -212,7 +212,6 @@ EOTEXT return 0; } - $renderer = new ArcanistLintRenderer(); $failures = array(); foreach ($results as $result) { if (!$result->getMessages()) { @@ -231,6 +230,8 @@ EOTEXT "lint checks for this commit, or '{$at}nolint' to the file with ". "errors to disable lint for that file.\n\n"); echo phutil_console_wrap($msg); + + $renderer = new ArcanistLintConsoleRenderer(); foreach ($failures as $result) { echo $renderer->renderLintResult($result); }