1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 08:52:39 +01:00

Use readable path in lint messages

Summary:
Some linters return absolute path.
It causes separate lint messages for the same file.
Also lint messages aren't properly bound in Phabricator.

I've preferred changing addLintMessage() to fixing all linters because it is
more robust.

Test Plan: arc lint of a file with lint problem from linter using absolute paths

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1589
This commit is contained in:
vrana 2012-02-07 09:57:26 -08:00
parent d3b0b009ce
commit 35837a39d2
2 changed files with 7 additions and 0 deletions

View file

@ -114,6 +114,11 @@ abstract class ArcanistLinter {
} }
protected function addLintMessage(ArcanistLintMessage $message) { protected function addLintMessage(ArcanistLintMessage $message) {
if (!$this->getEngine()->getCommitHookMode()) {
$root = $this->getEngine()->getWorkingCopy()->getProjectRoot();
$path = Filesystem::resolvePath($message->getPath(), $root);
$message->setPath(Filesystem::readablePath($path, $root));
}
$this->messages[] = $message; $this->messages[] = $message;
return $message; return $message;
} }

View file

@ -9,5 +9,7 @@
phutil_require_module('arcanist', 'lint/message'); phutil_require_module('arcanist', 'lint/message');
phutil_require_module('arcanist', 'lint/severity'); phutil_require_module('arcanist', 'lint/severity');
phutil_require_module('phutil', 'filesystem');
phutil_require_source('ArcanistLinter.php'); phutil_require_source('ArcanistLinter.php');