From 9b6e8aa6e1d02e4afc4cb4ab3944dac690bf171e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 14 Mar 2011 15:03:50 -0700 Subject: [PATCH] Resolve paths when running "--lintall" Summary: this was all kinds of fail when running from a subdirectory or on invalid paths. Detect nonexistent paths; resolve valid paths. Test Plan: ran "arc lint --lintall" on a file from a subdirectory, and on a file which did not exist. Received patches and an error, respectively Reviewers: arudolph CC: Differential Revision: 72 --- src/workflow/lint/ArcanistLintWorkflow.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/workflow/lint/ArcanistLintWorkflow.php b/src/workflow/lint/ArcanistLintWorkflow.php index a6cc812a..a030a950 100644 --- a/src/workflow/lint/ArcanistLintWorkflow.php +++ b/src/workflow/lint/ArcanistLintWorkflow.php @@ -139,6 +139,16 @@ EOTEXT throw new ArcanistUsageException( "You must specify one or more files to lint when using '--lintall'."); } + foreach ($paths as $key => $path) { + $full_path = Filesystem::resolvePath($path); + if (!Filesystem::pathExists($full_path)) { + throw new ArcanistUsageException("Path '{$path}' does not exist!"); + } + $relative_path = Filesystem::readablePath( + $full_path, + $working_copy->getProjectRoot()); + $paths[$key] = $relative_path; + } } if (!$engine) {