1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 08:42:40 +01:00

Make sure no one ever misunderstand the "unkonwn symbol" lint message ever again

Summary: A lot of new contributors don't resolve this. Make it easier to resolve, more comprehensive, and more explicit about not being ignorable.

Test Plan:
  >>> orbital ~/devtools/arcanist $ arc lint
  >>> Lint for src/lint/linter/ArcanistPhutilLibraryLinter.php:

     Error  (PHL1) Unknown Symbol
      Use of unknown class 'BlerpBarp'. Common causes are:

        - Your libphutil/ is out of date.
          This is the most common cause.
          Update this copy of libphutil: /INSECURE/devtools/libphutil

        - Some other library is out of date.
          Update the library this symbol appears in.

        - This symbol is misspelled.
          Spell the symbol name correctly.
          Symbol name spelling is case-sensitive.

        - This symbol was added recently.
          Run `arc liberate` on the library it was added to.

        - This symbol is external. Use `@phutil-external-symbol`.
          Use `grep` to find usage examples of this directive.

      *** ALTHOUGH USUALLY EASY TO FIX, THIS IS A SERIOUS ERROR.
      *** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT.

               181               "*** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT.");
               182
               183             if (false) {
      >>>      184               new BlerpBarp();
               185             }
               186           }
               187         }
  >>> orbital ~/devtools/arcanist $

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D7752
This commit is contained in:
epriestley 2013-12-10 08:33:35 -08:00
parent 4fdb87761b
commit e0b4eef9de

View file

@ -152,15 +152,33 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
continue; continue;
} }
$libphutil_root = dirname(phutil_get_library_root('phutil'));
$this->raiseLintInLibrary( $this->raiseLintInLibrary(
$library, $library,
$file, $file,
$offset, $offset,
self::LINT_UNKNOWN_SYMBOL, self::LINT_UNKNOWN_SYMBOL,
"Use of unknown {$type} '{$symbol}'. This symbol is not defined ". "Use of unknown {$type} '{$symbol}'. Common causes are:\n\n".
"in any loaded phutil library. It might be misspelled, or it ". " - Your libphutil/ is out of date.\n".
"may have been added recently. Make sure libphutil and other ". " This is the most common cause.\n".
"libraries are up to date."); " Update this copy of libphutil: {$libphutil_root}\n".
"\n".
" - Some other library is out of date.\n".
" Update the library this symbol appears in.\n".
"\n".
" - This symbol is misspelled.\n".
" Spell the symbol name correctly.\n".
" Symbol name spelling is case-sensitive.\n".
"\n".
" - This symbol was added recently.\n".
" Run `arc liberate` on the library it was added to.\n".
"\n".
" - This symbol is external. Use `@phutil-external-symbol`.\n".
" Use `grep` to find usage examples of this directive.\n".
"\n".
"*** ALTHOUGH USUALLY EASY TO FIX, THIS IS A SERIOUS ERROR.\n".
"*** THIS ERROR IS YOUR FAULT. YOU MUST RESOLVE IT.");
} }
} }
} }