Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15382738
D13570.id32938.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13570.id32938.diff
View Options
diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php
--- a/src/workflow/ArcanistLintWorkflow.php
+++ b/src/workflow/ArcanistLintWorkflow.php
@@ -97,6 +97,11 @@
"With 'compiler', show lint warnings in suitable for your editor. ".
"With 'xml', show lint warnings in the Checkstyle XML format."),
),
+ 'outfile' => array(
+ 'param' => 'path',
+ 'help' => pht(
+ 'Output the linter results to a file. Defaults to stdout.'),
+ ),
'only-new' => array(
'param' => 'bool',
'supports' => array('git', 'hg'), // TODO: svn
@@ -464,7 +469,19 @@
}
$all_autofix = true;
- $console->writeOut('%s', $renderer->renderPreamble());
+ $tmp = null;
+
+ if ($this->getArgument('outfile') !== null) {
+ $tmp = id(new TempFile())
+ ->setPreserveFile(true);
+ }
+
+ $preamble = $renderer->renderPreamble();
+ if ($tmp) {
+ Filesystem::appendFile($tmp, $preamble);
+ } else {
+ $console->writeOut('%s', $preamble);
+ }
foreach ($results as $result) {
$result_all_autofix = $result->isAllAutofix();
@@ -479,7 +496,11 @@
$lint_result = $renderer->renderLintResult($result);
if ($lint_result) {
- $console->writeOut('%s', $lint_result);
+ if ($tmp) {
+ Filesystem::appendFile($tmp, $lint_result);
+ } else {
+ $console->writeOut('%s', $lint_result);
+ }
}
if ($apply_patches && $result->isPatchable()) {
@@ -516,7 +537,13 @@
}
}
- $console->writeOut('%s', $renderer->renderPostamble());
+ $postamble = $renderer->renderPostamble();
+ if ($tmp) {
+ Filesystem::appendFile($tmp, $postamble);
+ Filesystem::rename($tmp, $this->getArgument('outfile'));
+ } else {
+ $console->writeOut('%s', $postamble);
+ }
if ($wrote_to_disk && $this->shouldAmendChanges) {
if ($this->shouldAmendWithoutPrompt ||
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 2:12 PM (1 w, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7695451
Default Alt Text
D13570.id32938.diff (1 KB)
Attached To
Mode
D13570: Output lint XML results to a file
Attached
Detach File
Event Timeline
Log In to Comment