Page MenuHomePhabricator

HTTPSFuture has a missing parameter in an exception message when overwriting a download path
Closed, ResolvedPublic

Description

See https://discourse.phabricator-community.org/t/httpsfuture-error-message-generation/4198. This error is missing a parameter:

throw new Exception(
  pht(
    'Specified download path "%s" already exists, refusing to '.
    'overwrite.'));

This is supposed to be checked statically, but may have slipped through when wilds merged down. Plans:

  • Check if arc lint catches this.
    • Yes: probably slipped through the wilds merge.
    • No: fix the linter.
  • Provide the parameter.

Event Timeline

epriestley created this task.

Check if arc lint catches this.

arc lint does not catch this. This test in the lint rule is too narrow:

-      if ($format->getTypeName() != 'n_STRING_SCALAR') {
         continue;

The correct test is:

+      if (!$format->isConstantString()) {
         continue;

In particular, when the parameter is in the form 'a'.'b', the node has type n_CONCATENATION_LIST, not n_STRING_SCALAR, but it is still appropriate to apply this lint rule.

This should be fixed by D21453.

  • D21454 fixes the specific issue in HTTPSFuture.

I'm now attempting to arc lint --everything to find possible errors which the linter previous missed. An initial issue is that when an xsprintf() call has an n_HEREDOC parameter, the parser can't extract the string literal.

  • D21455 supports extraction of the string literal.

After this change, I was able to lint arcanist/.

  • D21456 fixes additional errors identified by the corrected linter.
epriestley claimed this task.
  • D21457 fixes approximately 20 additional errors identified by the linter in phabricator/.