Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891349
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/lint/engine/ArcanistSingleLintEngine.php b/src/lint/engine/ArcanistSingleLintEngine.php
index 34249b8c..1b2b0114 100644
--- a/src/lint/engine/ArcanistSingleLintEngine.php
+++ b/src/lint/engine/ArcanistSingleLintEngine.php
@@ -1,62 +1,71 @@
<?php
/**
* Run a single linter on every path unconditionally. This is a glue engine for
* linters like @{class:ArcanistScriptAndRegexLinter}, if you are averse to
* writing a phutil library. Your linter will receive every path, including
* paths which have been moved or deleted.
*
* Set which linter should be run by configuring `lint.engine.single.linter` in
* `.arcconfig` or user config.
*/
final class ArcanistSingleLintEngine extends ArcanistLintEngine {
public function buildLinters() {
$key = 'lint.engine.single.linter';
$linter_name = $this->getConfigurationManager()
->getConfigFromAnySource($key);
if (!$linter_name) {
throw new ArcanistUsageException(
- "You must configure '{$key}' with the name of a linter in order to ".
- "use ArcanistSingleLintEngine.");
+ pht(
+ "You must configure '%s' with the name of a linter ".
+ "in order to use %s.",
+ $key,
+ __CLASS__));
}
if (!class_exists($linter_name)) {
throw new ArcanistUsageException(
- "Linter '{$linter_name}' configured in '{$key}' does not exist!");
+ pht(
+ "Linter '%s' configured in '%s' does not exist!",
+ $linter_name,
+ $key));
}
if (!is_subclass_of($linter_name, 'ArcanistLinter')) {
throw new ArcanistUsageException(
- "Linter '{$linter_name}' configured in '{$key}' MUST be a subclass of ".
- "ArcanistLinter.");
+ pht(
+ "Linter `%s` configured in '%s' MUST be a subclass of `%s`.",
+ $linter_name,
+ $key,
+ 'ArcanistLinter'));
}
// Filter the affected paths.
$paths = $this->getPaths();
foreach ($paths as $key => $path) {
if (!$this->pathExists($path)) {
// Don't lint removed files. In more complex linters it is sometimes
// appropriate to lint removed files so you can raise a warning like
// "you deleted X, but forgot to delete Y!", but most linters do not
// operate correctly on removed files.
unset($paths[$key]);
continue;
}
$disk = $this->getFilePathOnDisk($path);
if (is_dir($disk)) {
// Don't lint directories. (In SVN, they can be directly modified by
// changing properties on them, and may appear as modified paths.)
unset($paths[$key]);
continue;
}
}
$linter = newv($linter_name, array());
$linter->setPaths($paths);
return array($linter);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 15:05 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125782
Default Alt Text
(2 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment