]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Make sure no one ever misunderstand the "unkonwn symbol" lint message ever again
authorepriestley <git@epriestley.com>
Tue, 10 Dec 2013 16:33:35 +0000 (08:33 -0800)
committerepriestley <git@epriestley.com>
Tue, 10 Dec 2013 16:33:35 +0000 (08:33 -0800)
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

src/lint/linter/ArcanistPhutilLibraryLinter.php

index 5b695c183428e92cf8c3ada8e1d401157657fab3..d48c9dfcf01b019882e46519ab75dae3c7f5a58b 100644 (file)
@@ -152,15 +152,33 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
               continue;
             }
 
+            $libphutil_root = dirname(phutil_get_library_root('phutil'));
+
             $this->raiseLintInLibrary(
               $library,
               $file,
               $offset,
               self::LINT_UNKNOWN_SYMBOL,
-              "Use of unknown {$type} '{$symbol}'. This symbol is not defined ".
-              "in any loaded phutil library. It might be misspelled, or it ".
-              "may have been added recently. Make sure libphutil and other ".
-              "libraries are up to date.");
+              "Use of unknown {$type} '{$symbol}'. Common causes are:\n\n".
+              "  - Your libphutil/ is out of date.\n".
+              "    This is the most common cause.\n".
+              "    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.");
           }
         }
       }