Page MenuHomePhabricator

`ArcanistPhutilLibraryLinter` causes `arc lint` to die if there is a PHP syntax error
Closed, ResolvedPublic

Description

If there is a PHP syntax error in a file, ArcanistXHPASTLinter correctly lints the file (i.e. identifies the syntax error), but ArcanistPhutilLibraryLinter just fails miserably.

> arc lint
>>> Lint for src/applications/maniphest/mail/ManiphestReplyHandler.php:


   Error  (XHP1) PHP Syntax Error!
    This file contains a syntax error: XHPAST Parse Error: syntax error,
    unexpected '}' on line 182


             179       ));
             180     $event->setUser($user);
             181     PhutilEventEngine::dispatchEvent($event)
    >>>      182   }
             183 
             184 }
Exception
Some linters failed:
    - ArcanistPhutilLibraryLinter: CommandException: Command failed with error #1!
      COMMAND
      php '/home/joshua/dotfiles/modules/phabricator/libphutil/scripts/phutil_rebuild_map.php' --show --quiet --ugly -- '/home/joshua/workspace/github.com/phacility/phabricator/src'
      
      STDOUT
      
      SYNTAX ERROR!
      File: src/applications/maniphest/mail/ManiphestReplyHandler.php
      Line: 182
      
      XHPAST Parse Error: syntax error, unexpected '}' on line 182
      
      
      
      STDERR
      (empty)
(Run with --trace for a full exception trace.)

Revisions and Commits

Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

joshuaspence claimed this task.
joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Arcanist.
joshuaspence added subscribers: joshuaspence, epriestley.

Probably the ArcanistPhutilLibraryLinter should have a lower priority than ArcanistXHPASTLinter (and maybe also ArcanistPhutilXHPASTLinter).

In addition, we can probably try/catch syntax errors and ignore them (making an assumption that syntax errors will be linted elsewhere).

Closed by commit rARC3de9e4aaea61.